Ignore a job when there isn't a "data" key available.

main
Vincent Driessen 12 years ago
parent 223e09f4fe
commit 501a3870e1

@ -256,7 +256,7 @@ class Job(object):
""" """
key = self.key key = self.key
obj = self.connection.hgetall(key) obj = self.connection.hgetall(key)
if not obj: if len(obj) == 0:
raise NoSuchJobError('No such job: %s' % (key,)) raise NoSuchJobError('No such job: %s' % (key,))
def to_date(date_str): def to_date(date_str):
@ -265,7 +265,11 @@ class Job(object):
else: else:
return times.to_universal(date_str) return times.to_universal(date_str)
self.data = obj.get('data') try:
self.data = obj['data']
except KeyError:
raise NoSuchJobError('Unexpected job format: {0}'.format(obj))
try: try:
self._func_name, self._instance, self._args, self._kwargs = unpickle(self.data) self._func_name, self._instance, self._args, self._kwargs = unpickle(self.data)
except UnpickleError: except UnpickleError:

Loading…
Cancel
Save