Commit e91262be authored by Olivier Da Rocha's avatar Olivier Da Rocha Committed by ntome

[browser/exceptions] BrowserTooManyRequests: Check whether the next_try is...

[browser/exceptions] BrowserTooManyRequests: Check whether the next_try is None after the date check

If we check if next_try is None first, then we will set the next_try to
a default datetime that will be overriden by the next check on date.
parent 06797c95
......@@ -57,12 +57,12 @@ class BrowserTooManyRequests(BrowserUnavailable):
def __init__(self, message='', next_try=None):
super(BrowserTooManyRequests, self).__init__(message)
if isinstance(next_try, datetime.date) and not isinstance(next_try, datetime.datetime):
next_try = datetime.datetime.combine(next_try, datetime.datetime.min.time())
if next_try is None:
next_try = BrowserTooManyRequests.NEXT_24H
if isinstance(next_try, datetime.date):
next_try = datetime.datetime.combine(next_try, datetime.datetime.min.time())
self.next_try = next_try
def __str__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment