Settle down, Tiger. You asked this question on a Friday night. You may
need to wait a little more than 18 hours if you want a response.
We're all volunteers here, and many of us have professional and family
obligations that take priority over answering questions on a mailing
list.
To answer your question - although it may not be immediately obvious
to you _why_ this is occurring, the error message you have received
does tell you exactly _what_ is occurring.
Although form.errors appears to be a dictionary containing strings
(i.e., a dictionay of lists of strings appear when you print
form.errors), it's actually an ErrorDict that contains ValidationError
objects. These, in turn, are manipulated in various ways to ensure
correct unicode output - and one of those manipulations is the use of
proxy objects (django.utils.functional.__proxy__). If you call str()
on a proxy object, it will evaluate and return the underlying string,
but the object itself isn't a string.
SimpleJSON (and the Django copy of the SimpleJSON library) only knows
how to serialized basic Python types, so it complains when you give it
a proxy object. This use of proxy objects in this way was something
introduced by the introduction of full unicode support in Django.
Jacob's slide predate the introduction of feature, which explains why
the example he gave doesn't work out of the box with a more recent
Django version.
However, If you force the rollout of the proxy objects before calling
dumps(), SimpleJSON will correctly encode the form errors. Something
like:
>>> simplejson.dumps(dict((key,str(v) for v in values) for key,values in form.errors.items())
should do the trick.
Yours,
Russ Magee %-)