#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          |
-------------------------------------+-------------------------------------
Changes (by gwilson):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin
 * easy:   => 0


Comment:

 FWIW, this "broken" hasattr behavior seems to have recently been fixed for
 Python 3.2, see http://bugs.python.org/issue9666 and
 http://docs.python.org/py3k/whatsnew/3.2.html.  Also, hasattr calls
 getattr anyway so we wouldn't be doing any extra work if we were to just
 forgo the hasattr call and just try the attribute lookup (we later use the
 `request.user` lookup anyhow, so the point is moot).

 Patch 3 wouldn't work if someone were doing something funky with request
 and `__getattribute__`.

 I'm happy with putting in a workaround instead of waiting for Python 3.2
 support, and would favor patch 2 here due to it using a more Pythonic
 lookup.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15671#comment:12>
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