Use environ.get instead of try/except
This commit is contained in:
parent
f7c7746643
commit
701df2d201
@ -275,11 +275,8 @@ class Application(object):
|
|||||||
user, password = self.decode(base64.b64decode(
|
user, password = self.decode(base64.b64decode(
|
||||||
authorization.encode("ascii")), environ).split(":", 1)
|
authorization.encode("ascii")), environ).split(":", 1)
|
||||||
else:
|
else:
|
||||||
|
user = environ.get("REMOTE_USER")
|
||||||
password = None
|
password = None
|
||||||
try:
|
|
||||||
user = environ["REMOTE_USER"]
|
|
||||||
except KeyError:
|
|
||||||
user = None
|
|
||||||
|
|
||||||
is_authenticated = auth.is_authenticated(user, password)
|
is_authenticated = auth.is_authenticated(user, password)
|
||||||
is_valid_user = is_authenticated or not user
|
is_valid_user = is_authenticated or not user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user