X-Git-Url: https://git.mdrn.pl/fnpdjango.git/blobdiff_plain/4bc4a4cd7c8470de220e86fe44b50d427368c942..c5f50329c7ddea87333c6137d994252c47783aa4:/fnpdjango/utils/settings.py diff --git a/fnpdjango/utils/settings.py b/fnpdjango/utils/settings.py index 39b0a25..43f49ec 100644 --- a/fnpdjango/utils/settings.py +++ b/fnpdjango/utils/settings.py @@ -1,8 +1,18 @@ """ 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. @@ -14,11 +24,11 @@ class LazyUGettextLazy(object): 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))