From 38eae9aed2f0206bb4603125482dcbb867731956 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Sat, 16 Mar 2013 14:38:18 +0100 Subject: [PATCH] avoid unicode decode error in caching layer --- mygpo/cache.py | 2 +- mygpo/core/models.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mygpo/cache.py b/mygpo/cache.py index 0d34798f..85dfc1e1 100644 --- a/mygpo/cache.py +++ b/mygpo/cache.py @@ -21,7 +21,7 @@ def cache_result(**cache_kwargs): @wraps(f) def _get(*args, **kwargs): - key = sha1(str(f.__module__) + str(f.__name__) + str(args) + str(kwargs)).hexdigest() + key = sha1(str(f.__module__) + str(f.__name__) + unicode(args) + unicode(kwargs)).hexdigest() # the timeout parameter can't be used when getting from a cache get_kwargs = dict(cache_kwargs) diff --git a/mygpo/core/models.py b/mygpo/core/models.py index 256edadd..da377668 100644 --- a/mygpo/core/models.py +++ b/mygpo/core/models.py @@ -113,11 +113,10 @@ class Episode(Document, SlugMixin, OldIdMixin): return hash(self._id) - def __str__(self): - return '<{cls} {title} ({id})>'.format(cls=self.__class__.__name__, + def __unicode__(self): + return u'<{cls} {title} ({id})>'.format(cls=self.__class__.__name__, title=self.title, id=self._id) - __repr__ = __str__ class SubscriberData(DocumentSchema): -- 2.11.4.GIT