#15671: hasattr in RemoteUserMiddleware hides true errors and exceptions
-------------------------------------+-------------------------------------
               Reporter:  metzen     |          Owner:
                   Type:  Bug        |         Status:  new
              Milestone:             |      Component:  contrib.auth
                Version:  SVN        |       Severity:  Normal
             Resolution:             |       Keywords:
           Triage Stage:  Ready for  |      Has patch:  1
  checkin                            |    Needs tests:  0
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  0          |
-------------------------------------+-------------------------------------

Comment (by metzen):

 Would a solution using `dir()` work better with a customized
 `__getattribute__`?
 {{{
 if 'user' not in dir(request):
   raise ImproperlyConfigured
 }}}

 Alternatively, could something be done with inspecting the stack trace to
 find where the exception originated?

 The lack of patch2 to correctly raise `AttributeErrors` beneath the
 `request.user` lookup has actually bitten me several times in my current
 project.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15671#comment:13>
Django <http://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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to