EDIT: json.dumps(force_unicode(form.errors)) works but triggers the
dictionary-to-html conversion.



On Dec 19, 3:41 pm, Andrew <[EMAIL PROTECTED]> wrote:
> This is code that was working until sometime circa rev 6500...
>
> Assuming we have a newform object named form with errors in it:
>
> import django.utils.simplejson as json
> json.dumps(form.errors)
>
> gives:
> <type 'exceptions.TypeError'>: <django.utils.functional.__proxy__
> object at 0x128f110> is not JSON serializable
>
> In the shell, and fails silently in view code.
>
> If we do:
>
> json.dumps(force_unicode(form.errors))
>
> the serialization will work, but returns pythonic representations of
> unicode strings (u'foo'), which the JS frontend has no idea how to
> handle.
>
> All I want to do is serialize the form's errors as a dictionary... I'm
> guessing this should be easy?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to