From 5e5c27ef9531edd8ba22fa2c00302387a0bb2b8c Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 29 Apr 2019 15:23:18 +0200 Subject: [PATCH] Adjust django-guardian check for PY2 compatible version. --- rest_framework/compat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 9422e6ad56..d61ca5dbba 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -168,7 +168,12 @@ def is_guardian_installed(): """ django-guardian is optional and only imported if in INSTALLED_APPS. """ - if six.PY2: + try: + import guardian + except ImportError: + guardian = None + + if six.PY2 and (not guardian or guardian.VERSION >= (1, 5)): # Guardian 1.5.0, for Django 2.2 is NOT compatible with Python 2.7. # Remove when dropping PY2. return False 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