summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/tracking.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 7303e37..3a11d7a 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -48,6 +48,9 @@ class Consignment(Base):
s += ' (%s)' % self.label.encode('utf-8')
return s
+ def __unicode__(self):
+ return str(self).decode('utf-8')
+
class Package(Base):
__tablename__ = 'package'
@@ -67,6 +70,9 @@ class Package(Base):
s += ' (%s)' % self.consignment.label.encode('utf-8')
return s
+ def __unicode__(self):
+ return str(self).decode('utf-8')
+
class PackageError(Exception): pass
class NoPackageFound(PackageError): pass
@@ -235,7 +241,7 @@ class Module:
try:
self.track_update(row.code, propagate_error = True)
except PackageError as e:
- results.append('Failed to fetch data for %s.' % row)
+ results.append('Failed to fetch data for %s.' % unicode(row))
continue
i = 0
@@ -245,14 +251,14 @@ class Module:
desc = package.status
if date and desc:
- s = '%s %s - %s' % (package, date, desc)
+ s = '%s %s - %s' % (unicode(package), date, desc)
else:
- s = 'No tracking info found for %s' % package
+ s = 'No tracking info found for %s' % unicode(package)
results.append(s)
if i == 0:
- results.append('No packages found for %s' % row)
+ results.append('No packages found for %s' % unicode(row))
if len(results):
msg = results