use utf-8 instead of ascii

main
Alex Morega 12 years ago
parent 5b630b1e22
commit 328e7611d3

@ -61,7 +61,7 @@ else:
if v is None: if v is None:
return None return None
elif isinstance(v, bytes): elif isinstance(v, bytes):
return v.decode('ascii') return v.decode('utf-8')
elif isinstance(v, str): elif isinstance(v, str):
return v return v
else: else:

@ -210,7 +210,7 @@ class Job(object):
@classmethod @classmethod
def key_for(cls, job_id): def key_for(cls, job_id):
"""The Redis key that is used to store job hash under.""" """The Redis key that is used to store job hash under."""
return b'rq:job:' + job_id.encode('ascii') return b'rq:job:' + job_id.encode('utf-8')
@property @property
def key(self): def key(self):

@ -108,7 +108,7 @@ class TestJob(RQTestCase):
job.save() job.save()
expected_date = strip_milliseconds(job.created_at) expected_date = strip_milliseconds(job.created_at)
stored_date = self.testconn.hget(job.key, 'created_at').decode('ascii') stored_date = self.testconn.hget(job.key, 'created_at').decode('utf-8')
self.assertEquals( self.assertEquals(
times.to_universal(stored_date), times.to_universal(stored_date),
expected_date) expected_date)
@ -124,7 +124,7 @@ class TestJob(RQTestCase):
job.save() job.save()
expected_date = strip_milliseconds(job.created_at) expected_date = strip_milliseconds(job.created_at)
stored_date = self.testconn.hget(job.key, 'created_at').decode('ascii') stored_date = self.testconn.hget(job.key, 'created_at').decode('utf-8')
self.assertEquals( self.assertEquals(
times.to_universal(stored_date), times.to_universal(stored_date),
expected_date) expected_date)

Loading…
Cancel
Save