aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2013-05-18 17:22:27 +0100
committerTom Christie2013-05-18 17:22:27 +0100
commitbac4bf6e95d6cc6828115bd0a79cd524a6abd163 (patch)
tree431794e91dec87c099ffb3dcce8a50c4ce0507e7 /rest_framework/compat.py
parent0d3d66cb0232e1067600ef22fcf88937ac6bee9d (diff)
parent6af61a19b78b0ebb9d8403e96c6e4a77c675b141 (diff)
downloaddjango-rest-framework-bac4bf6e95d6cc6828115bd0a79cd524a6abd163.tar.bz2
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index cd39f544..76dc0052 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -495,3 +495,16 @@ except ImportError:
oauth2_provider_forms = None
oauth2_provider_scope = None
oauth2_constants = None
+
+# Handle lazy strings
+from django.utils.functional import Promise
+
+if six.PY3:
+ def is_non_str_iterable(obj):
+ if (isinstance(obj, str) or
+ (isinstance(obj, Promise) and obj._delegate_text)):
+ return False
+ return hasattr(obj, '__iter__')
+else:
+ def is_non_str_iterable(obj):
+ return hasattr(obj, '__iter__')