Skip to content

Commit fff9ad2

Browse files
carltongibsonsigvef
authored andcommitted
Adjust django-guardian check for PY2 compatible version. (encode#6613)
1 parent 10dc27e commit fff9ad2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework/compat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ def is_guardian_installed():
168168
"""
169169
django-guardian is optional and only imported if in INSTALLED_APPS.
170170
"""
171-
if six.PY2:
171+
try:
172+
import guardian
173+
except ImportError:
174+
guardian = None
175+
176+
if six.PY2 and (not guardian or guardian.VERSION >= (1, 5)):
172177
# Guardian 1.5.0, for Django 2.2 is NOT compatible with Python 2.7.
173178
# Remove when dropping PY2.
174179
return False

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy