diff options
| author | Tom Christie | 2014-12-15 11:55:17 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-15 11:55:17 +0000 |
| commit | 72e08a3e8b6427cb93f0f98b42724e31e5b3d8f9 (patch) | |
| tree | 9d2fe5ded957a5e1c6d86ac87aeafb4be3055ab2 /rest_framework/utils/representation.py | |
| parent | a72f812d80a4000e86a5ad96001f3fbf43fe310a (diff) | |
| download | django-rest-framework-72e08a3e8b6427cb93f0f98b42724e31e5b3d8f9.tar.bz2 | |
Use unicode internally everywhere for 'repr'
Diffstat (limited to 'rest_framework/utils/representation.py')
| -rw-r--r-- | rest_framework/utils/representation.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/utils/representation.py b/rest_framework/utils/representation.py index 3f17a8b9..0d829a83 100644 --- a/rest_framework/utils/representation.py +++ b/rest_framework/utils/representation.py @@ -2,9 +2,11 @@ Helper functions for creating user-friendly representations of serializer classes and serializer fields. """ +from __future__ import unicode_literals from django.db import models from django.utils.encoding import force_text from django.utils.functional import Promise +from rest_framework.compat import unicode_repr import re @@ -24,10 +26,11 @@ def smart_repr(value): if isinstance(value, Promise) and value._delegate_text: value = force_text(value) - value = repr(value) + value = unicode_repr(value) # Representations like u'help text' # should simply be presented as 'help text' + print type(value), value if value.startswith("u'") and value.endswith("'"): return value[1:] |
