fix decode error in py3.

main
Adam Wen 10 years ago
parent 1795e1ee53
commit f5001a0e36

@ -69,7 +69,9 @@ else:
string_types = (str, unicode) string_types = (str, unicode)
def as_text(v): def as_text(v):
return v if v is None:
return None
return v.decode('utf-8')
def decode_redis_hash(h): def decode_redis_hash(h):
return h return h

@ -407,8 +407,7 @@ class Job(object):
self.created_at = to_date(as_text(obj.get('created_at'))) self.created_at = to_date(as_text(obj.get('created_at')))
self.origin = as_text(obj.get('origin')) self.origin = as_text(obj.get('origin'))
self.description = (as_text(obj.get('description')).decode('utf-8') self.description = as_text(obj.get('description'))
if obj.get('description') else None)
self.enqueued_at = to_date(as_text(obj.get('enqueued_at'))) self.enqueued_at = to_date(as_text(obj.get('enqueued_at')))
self.ended_at = to_date(as_text(obj.get('ended_at'))) self.ended_at = to_date(as_text(obj.get('ended_at')))
self._result = unpickle(obj.get('result')) if obj.get('result') else None # noqa self._result = unpickle(obj.get('result')) if obj.get('result') else None # noqa

Loading…
Cancel
Save