#19272: gettext_lazy returns "unexpected type"
-------------------------------------+-------------------------------------
Reporter: tyrion | Owner: nobody
Type: Bug | Status: new
Component: Translations | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ygbo):
* status: closed => new
* resolution: fixed =>
Comment:
The issue still occurs with pgettext_lazy:
In [1]: from django.utils.translation import pgettext_lazy
In [2]: s = pgettext_lazy("a context", "foo bar") # using bytestring
In [3]: s.upper()
/usr/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py:53:
RuntimeWarning: SQLite received a naive datetime (2014-04-29
12:18:28.940685) while time zone support is active.
RuntimeWarning)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/usr/lib/python2.7/dist-packages/django/core/management/commands/shell.pyc
in <module>()
----> 1 s.upper()
/usr/lib/python2.7/dist-packages/django/utils/functional.pyc in
__wrapper__(self, *args, **kw)
121 if t in self.__dispatch:
122 return self.__dispatch[t][funcname](res,
*args, **kw)
--> 123 raise TypeError("Lazy object returned unexpected
type.")
124
125 if klass not in cls.__dispatch:
TypeError: Lazy object returned unexpected type.
In [4]: s = pgettext_lazy("a context", u"foo bar") # using unicode string
In [5]: s.upper()
Out[5]: u'FOO BAR'
--
Ticket URL: <https://code.djangoproject.com/ticket/19272#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.e9ef637843a79e7617ec769454953300%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.