From dfd23d6fb8febc656be57702fb9f0865e4c7f2c9 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 22 Apr 2014 22:19:52 +0200 Subject: [PATCH] Fix bug where RQ 0.4 could not unpickle jobs from RQ 0.3.x. --- rq/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rq/utils.py b/rq/utils.py index 7fd1b1e..30e9905 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -180,7 +180,11 @@ def utcformat(dt): 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):