#5590: JSON encoding fails on Promise (result of gettext_lazy)
---------------------------------+------------------------------------------
Reporter: jdunck | Owner: nobody
Status: new | Component: Uncategorized
Version: SVN | Keywords: unicode json serialization
i18n
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------+------------------------------------------
When attempting to dump a Promise, JSON encoding fails.
Example:
{{{
>>> s5 = ugettext_lazy('Yet another string')
>>> simplejson.dumps(s5, cls=json.DjangoJSONEncoder)
...
<type 'exceptions.TypeError'>: <django.utils.functional.__proxy__ object
at 0x171ca30> is not JSON serializable
}}}
I think the right solution is to have DjangoJSONEncoder handle casting to
string.
Patch attached.
--
Ticket URL: <http://code.djangoproject.com/ticket/5590>
Django Code <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
-~----------~----~----~----~------~----~------~--~---