From 1a178d673b838025522359116a82063f8a979a62 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 20 Jul 2012 14:26:05 +0200 Subject: [PATCH] Fix bug where results wasn't correctly unpickled when refreshing from Redis. --- CHANGES.md | 3 +++ rq/job.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 787106ca..fe119689 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,9 @@ ### 0.?.? (Not yet released) +- Fix important bug where result data wasn't restored from Redis correctly + (affected non-string results only). + ### 0.2.0 (July 18th, 2012) diff --git a/rq/job.py b/rq/job.py index 0718e976..718790df 100644 --- a/rq/job.py +++ b/rq/job.py @@ -211,7 +211,7 @@ class Job(object): self.description = obj.get('description') self.enqueued_at = to_date(obj.get('enqueued_at')) self.ended_at = to_date(obj.get('ended_at')) - self._result = obj.get('result') + self._result = unpickle(obj.get('result')) if obj.get('result') else None self.exc_info = obj.get('exc_info') self.timeout = int(obj.get('timeout')) if obj.get('timeout') else None @@ -238,7 +238,7 @@ class Job(object): if self.ended_at is not None: obj['ended_at'] = times.format(self.ended_at, 'UTC') if self._result is not None: - obj['result'] = self._result + obj['result'] = dumps(self._result) if self.exc_info is not None: obj['exc_info'] = self.exc_info if self.timeout is not None: