Fix bug where RQ 0.4 could not unpickle jobs from RQ 0.3.x.

This commit is contained in:
Vincent Driessen 2014-04-22 22:19:52 +02:00
parent 39258e2c15
commit dfd23d6fb8
1 changed files with 5 additions and 1 deletions

View File

@ -180,7 +180,11 @@ def utcformat(dt):
def utcparse(string): def utcparse(string):
return datetime.datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ") try:
return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%SZ')
except ValueError:
# This catches RQ < 0.4 datetime format
return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%S.%f+00:00')
def first(iterable, default=None, key=None): def first(iterable, default=None, key=None):