summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2020-03-28 18:34:24 -0400
committerEli Collins <elic@assurancetechnologies.com>2020-03-28 18:34:24 -0400
commitad36df92db4464e0a08e2fc2bc8a1ca9485858b7 (patch)
tree405f4505c377a4700a8588800e25a65530509df7
parentdd552a8df1ddf04f591c523d0a8edd62c5e9b77f (diff)
downloadpasslib-ad36df92db4464e0a08e2fc2bc8a1ca9485858b7.tar.gz
passlib.ext.django: fix import that was removed in django 3
-rw-r--r--docs/history/1.7.rst2
-rw-r--r--passlib/ext/django/utils.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/docs/history/1.7.rst b/docs/history/1.7.rst
index 5b61513..0d25fb2 100644
--- a/docs/history/1.7.rst
+++ b/docs/history/1.7.rst
@@ -24,6 +24,8 @@ Bugfixes
* :func:`passlib.utils.safe_crypt`: Support :func:`crypt.crypt` throwing :exc:`OSError`,
which can happen as of Python 3.9 (:issue:`115`).
+* :mod:`passlib.ext.django`: fixed lru_cache import (django 3 compatibility)
+
**1.7.2** (2019-11-22)
======================
diff --git a/passlib/ext/django/utils.py b/passlib/ext/django/utils.py
index a83cb89..1d1bd67 100644
--- a/passlib/ext/django/utils.py
+++ b/passlib/ext/django/utils.py
@@ -447,7 +447,10 @@ class DjangoContextAdapter(DjangoTranslator):
self.get_user_category = get_user_category
# install lru cache wrappers
- from django.utils.lru_cache import lru_cache
+ try:
+ from functools import lru_cache # new py32
+ except ImportError:
+ from django.utils.lru_cache import lru_cache # py2 compat, removed in django 3 (or earlier?)
self.get_hashers = lru_cache()(self.get_hashers)
# get copy of original make_password