diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2012-07-21 12:03:32 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2012-07-21 12:03:32 +0200 |
commit | 1e79deb14c7a9bad16d75e0bc6cef8c282bffc1c (patch) | |
tree | 56fe2fc098473958bd9bd612272fac557ea2f439 | |
parent | df7687e7c0e0dfb8dbb1530c9faf6dca41a16f33 (diff) |
tracking: Fixed some newly added encoding oddities.
-rw-r--r-- | modules/tracking.py | 14 |
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 |