From 362a5812733ccc97336cea9ba5b1deebc3120ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20G=C3=B3recki?= Date: Sat, 2 Jul 2016 15:16:45 +0100 Subject: Remove WebOb related logic --- pyramid/authentication.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pyramid/authentication.py b/pyramid/authentication.py index 95d6a710d..c6fd8f466 100644 --- a/pyramid/authentication.py +++ b/pyramid/authentication.py @@ -1169,18 +1169,13 @@ def extract_http_basic_credentials(request): ``request`` The request object """ + authorization = request.headers.get('Authorization') + if not authorization: + return None + try: - # First try authorization extraction logic from WebOb - try: - authmeth, auth = request.authorization - except AttributeError: # Probably a DummyRequest - authorization = request.headers.get('Authorization') - if not authorization: - return None - - authmeth, auth = authorization.split(' ', 1) - except (ValueError, TypeError): - # not enough values to unpack or None is not iterable + authmeth, auth = authorization.split(' ', 1) + except ValueError: # not enough values to unpack return None if authmeth.lower() != 'basic': -- cgit v1.2.3