#22011: no request.user on error pages
-------------------------------+--------------------------------------
     Reporter:  nagyv          |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  closed
    Component:  Uncategorized  |                  Version:  1.5
     Severity:  Normal         |               Resolution:  wontfix
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by mjtamlyn):

 * status:  new => closed
 * needs_better_patch:   => 0
 * resolution:   => wontfix
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Unlike the 404 page, Django deliberately hobbles the rendering of the 500
 page. `request.user` which is provided by a piece of middleware is not
 available. It is recommended that you do not interact with the database
 during the rendering of a 500 as it is impossible to know why you're on
 the page and what pieces of middleware have run.

 If for example there is a 500 because the database is unavailable, a 500
 page which loads the user from the database would also error during its
 rendering - what do we do then? You could register a custom 500 handler
 which tried to carefully render a page using the user if it could, and
 fell back to a flat 500 page if not, but personally I would not advise it.

 I'm going to close this ticket as won't fix because I think Django's way
 of handling of the 500 page is correct - it should do its best to avoid
 any possible errors.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.6b0ebd03e63dca6a270b49480b01c2fc%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to