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:
Kun Huang
2013-07-14 18:16:05 +08:00
parent 2329e0a8e5
commit 39158466d3

View File

@@ -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):