From ad36df92db4464e0a08e2fc2bc8a1ca9485858b7 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sat, 28 Mar 2020 18:34:24 -0400 Subject: passlib.ext.django: fix import that was removed in django 3 --- docs/history/1.7.rst | 2 ++ passlib/ext/django/utils.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1