Allow changes to run under Python 3

This commit is contained in:
Philipp Hagemeister 2013-08-28 14:28:55 +02:00
parent 97b3656c2e
commit 48ea9cea77
3 changed files with 28 additions and 12 deletions

View file

@ -708,3 +708,13 @@ class DateRange(object):
return self.start <= date <= self.end
def __str__(self):
return '%s - %s' % ( self.start.isoformat(), self.end.isoformat())
def bytes_to_intlist(bs):
if not bs:
return []
if isinstance(bs[0], int): # Python 3
return list(bs)
else:
return [ord(c) for c in bs]