Code

Ticket #18171: type_error_raised.2.diff

File type_error_raised.2.diff, 718 bytes (added by renatooliveira, 22 months ago)
Line 
1diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py
2index 0b3ccf7..bde2137 100644
3--- a/django/contrib/auth/__init__.py
4+++ b/django/contrib/auth/__init__.py
5@@ -37,9 +37,9 @@ def authenticate(**credentials):
6     for backend in get_backends():
7         try:
8             user = backend.authenticate(**credentials)
9-        except TypeError:
10-            # This backend doesn't accept these credentials as arguments. Try the next one.
11-            continue
12+        except TypeError as e:
13+            if not 'argument' in e.message
14+                raise TypeError(e.message)
15         if user is None:
16             continue
17         # Annotate the user object with the path of the backend.