From: Michael Wood <michael.g.wood@intel.com>
To: "Reyna, David" <david.reyna@windriver.com>,
"BARROS PENA, BELEN" <belen.barros.pena@intel.com>
Cc: "toaster@yoctoproject.org" <toaster@yoctoproject.org>
Subject: Re: [review-request] [PATCH] dreyna/dir_expand_7810
Date: Wed, 19 Aug 2015 12:25:25 +0100 [thread overview]
Message-ID: <55D467A5.5050508@intel.com> (raw)
In-Reply-To: <5E53D14CE4667A45B9A06760DE5D13D0825AD2DD@ALA-MBA.corp.ad.wrs.com>
On 19/08/15 08:34, Reyna, David wrote:
> Hi Belén,
>
> I have pushed a fix for 7810:
> dreyna/dir_expand_7810
>
> It is very strange. The problem was that the AJAX call in "dirinfo.html" expects the response data to be a JSON-formatted string, and uses "parseJSON()" to convert that into a JS object for display computation.
>
> However, in debugging the code I found that the JS debugger recognized the "response" to now _already_ be a proper JS object, and the observed failure in the defect is that "parseJSON()" tries to convert it and immediately hits a syntax error.
>
> The fix is to simply skip the "parseJSON()", and now it all works. But I do not know why the AJAX operation changed, unless it was updated to take the JSON format indicator and perform the conversion automatically now, which would explain why it works the way it does.
>
> In any case, I have kept a note in the the patch indicated how "parseJSON()" is no longer needed, in case someone in the future puzzles over this.
>
> - David
>
Yes you're right, when an ajax call gets a JSON response it's
automatically parsed to a js object. Previously the response it was
getting was just a text/other response and therefore the manual parse
was needed. In commit:
commit c5a16235b8b56102703bc264768ba386ebe90611
Author: Alexandru DAMIAN <alexandru.damian@intel.com>
Date: Mon May 11 18:58:25 2015 +0100
bitbake: toaster: fix html5 compliance
This patch brings needed changes in all views so that
each view passes the HTML5 compliance test by the
W3C Markup Service.
This was changed:
- return HttpResponse(_get_dir_entries(build_id, target_id, top))
+ return HttpResponse(_get_dir_entries(build_id, target_id, top),
content_type = "application/json")
So the response type is now (correctly) marked as json and the ajax call
does the automatic parsing.
I don't think there is a need for the " /* object ready, no need for
$.parseJSON(response); */" comment as this is the expected behaviour. So
I’ll submit the patch without this if that's OK.
Thanks,
Michael
next prev parent reply other threads:[~2015-08-19 11:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 7:34 [review-request] [PATCH] dreyna/dir_expand_7810 Reyna, David
2015-08-19 11:25 ` Michael Wood [this message]
2015-08-19 14:58 ` Reyna, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D467A5.5050508@intel.com \
--to=michael.g.wood@intel.com \
--cc=belen.barros.pena@intel.com \
--cc=david.reyna@windriver.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.