All of lore.kernel.org
 help / color / mirror / Atom feed
* [review-request] [PATCH] dreyna/dir_expand_7810
@ 2015-08-19  7:34 Reyna, David
  2015-08-19 11:25 ` Michael Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Reyna, David @ 2015-08-19  7:34 UTC (permalink / raw)
  To: BARROS PENA, BELEN; +Cc: toaster

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [review-request] [PATCH] dreyna/dir_expand_7810
  2015-08-19  7:34 [review-request] [PATCH] dreyna/dir_expand_7810 Reyna, David
@ 2015-08-19 11:25 ` Michael Wood
  2015-08-19 14:58   ` Reyna, David
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wood @ 2015-08-19 11:25 UTC (permalink / raw)
  To: Reyna, David, BARROS PENA, BELEN; +Cc: toaster

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [review-request] [PATCH] dreyna/dir_expand_7810
  2015-08-19 11:25 ` Michael Wood
@ 2015-08-19 14:58   ` Reyna, David
  0 siblings, 0 replies; 3+ messages in thread
From: Reyna, David @ 2015-08-19 14:58 UTC (permalink / raw)
  To: WOOD, MICHAEL; +Cc: toaster

>  So I’ll submit the patch without this if that's OK.

Yes, that would be great!

David
> On Aug 19, 2015, at 4:25 AM, Michael Wood <michael.g.wood@intel.com> wrote:
> 
> So I’ll submit the patch without this if that's OK.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-19 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19  7:34 [review-request] [PATCH] dreyna/dir_expand_7810 Reyna, David
2015-08-19 11:25 ` Michael Wood
2015-08-19 14:58   ` Reyna, David

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.