summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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