aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorNikolaus Schlemm2013-05-19 09:02:07 +0200
committerNikolaus Schlemm2013-05-19 09:02:07 +0200
commit9454e23aa927931dcb7a6921c6ad238f6369e64e (patch)
tree967fcbf13b3186a187c72ca9645cb24dbf6b425a /rest_framework/compat.py
parent843ae6023753a0373eb2e6398ddda93e4da74de5 (diff)
parent7c945b43f05f1b340f78c23f80c8043937c7fd2a (diff)
downloaddjango-rest-framework-9454e23aa927931dcb7a6921c6ad238f6369e64e.tar.bz2
Merge branch 'master' of git://github.com/tomchristie/django-rest-framework into issue-192-expose-fields-for-options
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__')