#8768: Document that ugettext_lazy returns `<django.utils.functional.__proxy__
object at 0x11b1310>` in non-unicode string context
------------------------------------+---------------------------------------
Reporter: mrts | Owner: nobody
Status: new | Milestone:
Component: Documentation | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by mtredinnick):
Some clarification could be made in this area, but this proposed patch
isn't correct. "String context" is used intentionally in the documentation
and does not mean "bytestrings" (e.g. `str()`). People need to be thinking
that strings are either bytestrings or unicode. Format markers do work
with `ugettext_lazy()`, etc.
The whole issue being reported here is that using something that is a
proxy for a unicode string in a bytestring context fails. It also doesn't
work in Python to use unicode where a bytestring is expected, so this
isn't particularly unusual behaviour (try substituting a unicode string
using `%s` into a normal bytestring and it fails similarly but with a
different error). We should clarify that `ugettext_lazy` is only to be
used where a unicode string is valid. But the rest of the stuff isn't
necessary, since it only draws attention to incorrect usage (all the
examples are covered by not using unicode where a bytestring is needed)
and makes the root problem look much bigger than it actually is.
--
Ticket URL: <http://code.djangoproject.com/ticket/8768#comment:4>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---