Update: The info about "normal location" for response data is
incorrect. With YUI Connection Manager the response data is always in
o.responseText. My problem had something to do with "text/html" mime
encoding of the escaped string "<br \/>". Somehow this was getting
changed at the browser to "<br \=\"\">", and that would not JSON
decode. Replacing "<br />" with "<br>" solves the problem because the
pesky escaping weirdness no longer occurs.

On Jan 3, 9:48 am, "Graham Ullrich" <[EMAIL PROTECTED]> wrote:
> Malcolm,
> Thanks so much for your suggestion. With that knowledge I found the problem
> in 10 minutes. The culprit turns out to be the YUI Connection Manager. As it
> turns out, when handling a file upload they change the location of the
> returned data. My response gets placed in a totally different child element
> when there is a file field, and yet the "normal" location contains an
> escaped version of the response.
>
> FWIW, the normal location for the view response data is o.responseText. With
> a file upload, the location is o.responseXML.body.textContent.
>
> Thanks again.
> Graham
>
> On 1/3/08, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> > [...]
> > > As an example, the JSON response seen by the javascript might be:
>
> > >    "<pre>{\"valid\": false, \"errors\": {\"options\": \"&lt;ul class=\
> > > \"errorlist\\"&gt;&lt;li&gt;This field is required.&lt;\/li&gt;&lt;\/
> > > ul&gt;\"}}</pre>"
>
> > > when it should be:
>
> > >    "{\"valid\": false, \"errors\": {\"options\": \"<ul class=\
> > > \"errorlist\\"><li>This field is required.<\/li><\/ul>\"}}"
>
> > > You can see that the Django system encapsulates the entire response in
> > > <pre></pre> tags. Additionally, the underlying error message HTML is
> > > also escaped.
>
> > You might want to double-check that you're debugging the correct
> > problem. There is no code in Django that is adding the "pre" tags here.
> > The only occurrence of the string "<pre" in the source code is in a
> > docstring for the "debug" template tag. So working out at which step
> > that extra content is being added will no doubt help you zero in on the
> > problem code.
>
> > Regards,
> > Malcolm
>
> > --
> > Two wrongs are only the beginning.
> >http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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