Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2011-04-25 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+-
   Reporter: |  Owner:  nobody
  bendavis78 | Status:  closed
   Type:  Bug|  Component:  contrib.auth
  Milestone: |   Severity:  Normal
Version:  1.0|   Keywords:  authenticate
 Resolution:  wontfix|  TypeError
   Triage Stage:  Design |  Has patch:  0
  decision needed|Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
-+-
Changes (by SmileyChris):

 * status:  new => closed
 * resolution:   => wontfix
 * easy:   => 0


Comment:

 Backing up Malcolm's -1 and closing the issue. Unfortunate, but that's
 about it.

-- 
Ticket URL: 
Django 
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.



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2011-04-01 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+-
   Reporter: |Owner:  nobody
  bendavis78 |   Status:  new
   Type:  Bug|Component:  contrib.auth
  Milestone: | Severity:  Normal
Version:  1.0| Keywords:  authenticate
 Resolution: |  TypeError
   Triage Stage:  Design |Has patch:  0
  decision needed|  Needs tests:  0
Needs documentation:  0  |
Patch needs improvement:  0  |
-+-
Changes (by SmileyChris):

 * type:   => Bug
 * severity:   => Normal


-- 
Ticket URL: 
Django 
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.



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-06-17 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+--
  Reporter:  bendavis78  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Authentication  |   Version:  1.0  
 
Resolution:  |  Keywords:  authenticate 
TypeError
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Comment (by bendavis78):

 If anyone's curious about a workaround for this,  you can wrap your
 authenticate to catch the !TypeError.  I created a custom exception called
 "!NextBackend" that I throw if I want the authentication backend to
 continue,  then in the wrapper if a !TypeError is caught, throw it as a
 "_TypeError" exception so that a real !TypeError is not caught by the core
 auth code.

 {{{
 #!python
 class NextBackend(Exception): pass
 class _TypeError(Exception): pass

 class MyCustomBackend(ModelBackend):
 """
 Wrapper method for _authenticate(). See
 http://code.djangoproject.com/ticket/10378
 """
 def authenticate(self, **kwargs):
 try:
 return self._authenticate(**kwargs)
 except TypeError:
 e, args, tb = sys.exc_info()
 raise _TypeError, args, tb
 except NextBackend:
 raise TypeError

 def _authenticate(self, **kwargs):
 # Your auth code here...
 if authentication_fails():
 raise NextBackend

 }}}

 It's fugly but it works :-P

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-05-06 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+--
  Reporter:  bendavis78  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Authentication  |   Version:  1.0  
 
Resolution:  |  Keywords:  authenticate 
TypeError
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Changes (by thejaswi_puthraya):

  * component:  Contrib apps => Authentication

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-05-06 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+--
  Reporter:  bendavis78  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Contrib apps|   Version:  1.0  
 
Resolution:  |  Keywords:  authenticate 
TypeError
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Changes (by thejaswi_puthraya):

  * component:  Uncategorized => Contrib apps

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-02-28 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+--
  Reporter:  bendavis78  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Uncategorized   |   Version:  1.0  
 
Resolution:  |  Keywords:  authenticate 
TypeError
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Comment (by mtredinnick):

 Would be backwards incompatible. I know we've said "contrib" has an
 exception from the backwards compatibility guarantee, but we still
 shouldn't make changes like this without strong reason, particularly in
 something as heavily used as the authentication area. We fail safe here
 (don't let anybody in if things are raised), so it's only a
 diagnostic/debugging issue, not a functionality one.

 I'm pretty close to -1 on making this change at the moment. It's
 unfortunate, but not that harmful to leave it as is.

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---



Re: [Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-02-28 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
-+--
  Reporter:  bendavis78  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Uncategorized   |   Version:  1.0  
 
Resolution:  |  Keywords:  authenticate 
TypeError
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

  * needs_better_patch:  => 0
  * stage:  Unreviewed => Design decision needed
  * needs_tests:  => 0
  * needs_docs:  => 0

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---



[Django] #10378: authenticate() method should not continue on built-in or generic exceptions

2009-02-28 Thread Django
#10378: authenticate() method should not continue on built-in or generic 
exceptions
+---
 Reporter:  bendavis78  |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Uncategorized   | Version:  1.0   
 Keywords:  authenticate TypeError  |   Stage:  Unreviewed
Has_patch:  0   |  
+---
 from django.contrib.auth,  in authenticate():
 {{{
 for backend in get_backends():
 try:
 user = backend.authenticate(**credentials)
 except TypeError:
 # This backend doesn't accept these credentials as arguments.
 Try the next one.
 continue
 if user is None:
 continue
 }}}

 The authenticate method makes an assumption about the meaning of a
 !TypeError,  being that "this backend doesn't accept these credentials as
 arguments". It ''should'' use a custom exception type where the meaning is
 more specific, such as !AuthInvalidCredentials or something.

 The reasoning behind this is that when creating your own authentication
 backend,  it's possible to do some things that unexpectedly raise a more
 generic exception, such as !TypeError.  This can produce some very
 unexpected results, as this will cause your backend to be "skipped" when
 it shouldn't have been.

 Granted,  I could work around this by catching !TypeError within the
 backend,  but the backend developer shouldn't have to know that he/she
 needs to do that.  Plus, the developer would have to go through some hoops
 to actually see the exception that was caught (eg, extracting traceback
 info from sys.exc_info())

-- 
Ticket URL: 
Django 
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
-~--~~~~--~~--~--~---