"""
Utilities for global settings.
"""
+from django.utils.encoding import python_2_unicode_compatible
+# Use Python3 str.
+try:
+ unicode
+except NameError:
+ pass
+else:
+ str = unicode
+
+@python_2_unicode_compatible
class LazyUGettextLazy(object):
"""You can use it to internationalize strings in settings.
def __init__(self, text):
self.text = text
- def __unicode__(self):
+ def __str__(self):
if not self.real:
from django.utils.translation import ugettext_lazy
LazyUGettextLazy._ = staticmethod(ugettext_lazy)
LazyUGettextLazy.real = True
- return unicode(self._(self.text))
+ return str(self._(self.text))