Skip to content

Commit

Permalink
Python 3 compatibility fix.
Browse files Browse the repository at this point in the history
The keys from the dictionary returned by `hgetall` are byte arrays
and not strings.
  • Loading branch information
alexkiro committed Nov 5, 2014
1 parent 7e8bab2 commit 3fa1af9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pyzor/engines/redis_.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ def _encode_record(r):
def _decode_record(r):
if not r:
return Record()
return Record(r_count=int(r.get("r_count", 0)),
r_entered=decode_date(r.get("r_entered", 0)),
r_updated=decode_date(r.get("r_updated", 0)),
wl_count=int(r.get("wl_count", 0)),
wl_entered=decode_date(r.get("wl_entered", 0)),
wl_updated=decode_date(r.get("wl_updated", 0)))
return Record(r_count=int(r.get(b"r_count", 0)),
r_entered=decode_date(r.get(b"r_entered", 0)),
r_updated=decode_date(r.get(b"r_updated", 0)),
wl_count=int(r.get(b"wl_count", 0)),
wl_entered=decode_date(r.get(b"wl_entered", 0)),
wl_updated=decode_date(r.get(b"wl_updated", 0)))

def __iter__(self):
for key in self.db.keys(self._real_key("*")):
Expand Down

0 comments on commit 3fa1af9

Please sign in to comment.