summaryrefslogtreecommitdiff
path: root/django/utils/encoding.py
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-07-02 10:49:53 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-07-02 10:49:53 +0100
commitb1e0ec06f0d538eb2ab16a7c1ecefd1d896e6382 (patch)
treeb837c6144106f304a7aacdfd4fae47ea95f4158a /django/utils/encoding.py
parent7a47ba6f6aeca36b8b092dbafd36abb342d34d4b (diff)
parent6c66a41c3dc697dc3bda4e31e8b05084d2ede915 (diff)
Merge branch 'master' into schema-alteration
Diffstat (limited to 'django/utils/encoding.py')
-rw-r--r--django/utils/encoding.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/django/utils/encoding.py b/django/utils/encoding.py
index adab0d0712..aa0218ca6b 100644
--- a/django/utils/encoding.py
+++ b/django/utils/encoding.py
@@ -8,7 +8,6 @@ try:
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
-import warnings
from django.utils.functional import Promise
from django.utils import six
@@ -23,29 +22,6 @@ class DjangoUnicodeDecodeError(UnicodeDecodeError):
return '%s. You passed in %r (%s)' % (original, self.obj,
type(self.obj))
-class StrAndUnicode(object):
- """
- A class that derives __str__ from __unicode__.
-
- On Python 2, __str__ returns the output of __unicode__ encoded as a UTF-8
- bytestring. On Python 3, __str__ returns the output of __unicode__.
-
- Useful as a mix-in. If you support Python 2 and 3 with a single code base,
- you can inherit this mix-in and just define __unicode__.
- """
- def __init__(self, *args, **kwargs):
- warnings.warn("StrAndUnicode is deprecated. Define a __str__ method "
- "and apply the @python_2_unicode_compatible decorator "
- "instead.", DeprecationWarning, stacklevel=2)
- super(StrAndUnicode, self).__init__(*args, **kwargs)
-
- if six.PY3:
- def __str__(self):
- return self.__unicode__()
- else:
- def __str__(self):
- return self.__unicode__().encode('utf-8')
-
def python_2_unicode_compatible(klass):
"""
A decorator that defines __unicode__ and __str__ methods under Python 2.