[Django] #18229: Allow configuration of debug response format for AJAX errors

66 views
Skip to first unread message

Django

unread,
Apr 28, 2012, 1:22:53 PM4/28/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+--------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------
The plaintext error responses for AJAX requests in 1.4 drop a lot of the
stack trace context that was included in the HTML responses pre-1.4. Tools
like the network response 'Preview' viewer in Chrome make it easy to
navigate the HTML response to drill down into the richer context it
provides. The pull request linked below maintains the 1.4 default but
enables the response to be configured to use the original behavior.

[https://github.com/django/django/pull/8]

--
Ticket URL: <https://code.djangoproject.com/ticket/18229>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 28, 2012, 1:39:40 PM4/28/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+--------------------------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by davehughes05@…):

* needs_docs: => 1
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

Original ticket: #10841

Changeset: https://code.djangoproject.com/changeset/16921

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:1>

Django

unread,
Apr 28, 2012, 5:42:17 PM4/28/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+--------------------------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by adrian):

I agree we should allow this somehow for Chrome, but I'd prefer not to add
yet another setting. The barrier to entry for settings is higher. Can you
think of another way to solve it?

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:2>

Django

unread,
Apr 28, 2012, 7:04:22 PM4/28/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+--------------------------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by davehughes05@…):

I can't think of an alternative that allows both behaviors without
configuring which one is preferred, short of reading the developer's mind
:-)

Expanding the returned plaintext to include contextual code and serialized
variables (the way they appear in the HTML error result) would probably
solve the issue for me. This information could be presented toward the
bottom of the trace so the summarizing information is more prominent.

This would likely involve a more in-depth patch, but wouldn't require
adding yet another setting. Is this approach worth pursuing, in your
opinion?

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:3>

Django

unread,
Apr 29, 2012, 2:49:20 PM4/29/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+--------------------------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by adrian):

Dave -- Sure, improving the text version to include the contextual code
and variables sounds like the better plan. I agree that information should
appear at the bottom, to present the most important stuff first. Have a go
at implementing it!

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:4>

Django

unread,
May 20, 2012, 1:11:35 PM5/20/12
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+------------------------------------
Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by jezdez):

* stage: Unreviewed => Accepted


Comment:

Marking as accepted as there has apparently been an understanding about
the issue already.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:5>

Django

unread,
Jun 9, 2013, 9:31:59 AM6/9/13
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+------------------------------------

Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Kamu):

* has_patch: 1 => 0


Comment:

Removing has patch because the pull request was closed in preference of
another implementation.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:6>

Django

unread,
Aug 26, 2013, 6:53:59 AM8/26/13
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+------------------------------------

Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+------------------------------------

Comment (by FunkyBob):

Which other implementation was chosen?

Is there a separate ticket for it?

Should this be closed as a dupe or fixed?

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:7>

Django

unread,
Sep 18, 2013, 8:50:49 PM9/18/13
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+------------------------------------

Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by timo):

* needs_docs: 1 => 0
* easy: 1 => 0


Comment:

I think the implementation chosen was "improving the text version to
include the contextual code and variables sounds". I don't think it has
been implemented yet.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:8>

Django

unread,
Mar 6, 2014, 1:47:15 AM3/6/14
to django-...@googlegroups.com
#18229: Allow configuration of debug response format for AJAX errors
--------------------------------+------------------------------------

Reporter: davehughes05@… | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------

Comment (by anubhav9042):

I hope/intend to work on this in gsoc.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:9>

Django

unread,
Jun 13, 2014, 5:29:56 AM6/13/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by anubhav9042):

* status: new => assigned
* owner: nobody => anubhav9042
* version: 1.4 => master


--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:10>

Django

unread,
Jun 13, 2014, 8:19:22 AM6/13/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by timo):

As a possible starting point, I've used
[https://djangosnippets.org/snippets/650/ this middleware] before to make
it easier to read AJAX exceptions.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:11>

Django

unread,
Jun 14, 2014, 3:47:00 PM6/14/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by anubhav9042):

I have compared the two Templates and have added a small diff based on
that.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:12>

Django

unread,
Jun 15, 2014, 11:28:32 AM6/15/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by timo):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:13>

Django

unread,
Jun 16, 2014, 6:31:29 AM6/16/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by anubhav9042):

If the changes are good, then I'll open a PR. Also is there a need to
update tests here as the text response is not tested that extensively?

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:14>

Django

unread,
Jun 17, 2014, 3:20:30 PM6/17/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1


Comment:

The output of the new version is much more cluttered and one of the new
lines exceeds 8600 characters in my test. Please post a sample diff of the
output between the old and new versions with your next revision, thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:15>

Django

unread,
Jun 17, 2014, 4:37:41 PM6/17/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by timo):

Maybe sniffing the user agent `HttpRequest.META['HTTP_USER_AGENT']` and
returning the HTML version for Chrome would be a better solution. Actually
Firefox inspector and Firebug can also preview HTML. I wonder if we should
consider dropping the plain text version for AJAX requests in light of
browser improvements? May need a django-developers thread.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:16>

Django

unread,
Jun 18, 2014, 8:57:01 AM6/18/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by timo):

Actually I see the fact that some browsers can preview HTML from AJAX
requests was [https://code.djangoproject.com/ticket/10841#comment:21
already raised] in the original thread, so dropping plain text probably
isn't an option.

I'm having trouble coming up with a good way to present the context code
and variables that doesn't seem cluttered.

@davehughes05, if you still care about this issue do you have any
thoughts?

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:17>

Django

unread,
Jun 23, 2014, 6:22:40 PM6/23/14
to django-...@googlegroups.com
#18229: Improving the AJAX Error text version to include the contextual code and
variables
--------------------------------+---------------------------------------
Reporter: davehughes05@… | Owner: anubhav9042
Type: New feature | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by timo):

* status: assigned => closed
* resolution: => wontfix


Comment:

Closing given lack of follow-up from reporter. If someone feels strongly
about this and wants to implement something that isn't too ugly, we'll
consider it.

--
Ticket URL: <https://code.djangoproject.com/ticket/18229#comment:18>

Reply all
Reply to author
Forward
0 new messages