#27382: Document that ugettext_lazy() result can't be used with arbitrary Python
code
-------------------------------+---------------------------
Reporter: Mike Edmunds | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.10
Severity: Normal | Keywords: ugettext_lazy
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------
The documentation
[https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#working-
with-lazy-translation-objects currently states] that:
The result of a `ugettext_lazy()` call can be used wherever you would
use a unicode string (an object with type `unicode`) in Python.
However, the result of ugettext_lazy() does not pass `isinstance(lazy_obj,
unicode)`. Because instance checks are commonly used to detect text
strings, the lazy objects are incompatible with some Python standard
library code and other popular Python packages (such as requests).
Proposed doc patch clarifies that ugettext_lazy() can be used with other
Django code, but that it should generally be converted to text before
passing to arbitrary, non-Django Python code.
Discussion and examples on django-dev:
https://groups.google.com/forum/#!topic/django-developers/eFsGf1ZrG7c
--
Ticket URL: <https://code.djangoproject.com/ticket/27382>
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/051.6eb3d4f5ccff3a1c9b04644f5a6e0281%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.