aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/_compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/_compat.py')
-rw-r--r--mediagoblin/_compat.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/mediagoblin/_compat.py b/mediagoblin/_compat.py
index c992f44e..09270ab4 100644
--- a/mediagoblin/_compat.py
+++ b/mediagoblin/_compat.py
@@ -1,15 +1,11 @@
import functools
import warnings
-import six
-
from email.mime.text import MIMEText
def encode_to_utf8(method):
def wrapper(self):
- if six.PY2 and isinstance(method(self), str):
- return method(self).encode('utf-8')
return method(self)
functools.update_wrapper(wrapper, method, ['__name__', '__doc__'])
return wrapper
@@ -17,13 +13,4 @@ def encode_to_utf8(method):
# based on django.utils.encoding.python_2_unicode_compatible
def py2_unicode(klass):
- if six.PY2:
- if '__str__' not in klass.__dict__:
- warnings.warn("@py2_unicode cannot be applied "
- "to %s because it doesn't define __str__()." %
- klass.__name__)
- klass.__unicode__ = klass.__str__
- klass.__str__ = encode_to_utf8(klass.__unicode__)
- if '__repr__' in klass.__dict__:
- klass.__repr__ = encode_to_utf8(klass.__repr__)
return klass