rm improper assert syntax
assert only raise AssertionError when runing python without '-O', so if we except an Assertionerror in codes, just raise it instead of using assert syntax instead of different result with or without '-O' flag Change-Id: I8c1bc2c6849996f0d3f7a4b791671871d79dd939
This commit is contained in:
@@ -667,8 +667,8 @@ class AuthProtocol(object):
|
|||||||
try:
|
try:
|
||||||
token = data['access']['token']['id']
|
token = data['access']['token']['id']
|
||||||
expiry = data['access']['token']['expires']
|
expiry = data['access']['token']['expires']
|
||||||
assert token
|
if not (token and expiry):
|
||||||
assert expiry
|
raise AssertionError('invalid token or expire')
|
||||||
datetime_expiry = timeutils.parse_isotime(expiry)
|
datetime_expiry = timeutils.parse_isotime(expiry)
|
||||||
return (token, timeutils.normalize_time(datetime_expiry))
|
return (token, timeutils.normalize_time(datetime_expiry))
|
||||||
except (AssertionError, KeyError):
|
except (AssertionError, KeyError):
|
||||||
|
Reference in New Issue
Block a user