From: hernani Date: Wed, 13 Apr 2011 00:33:47 +0000 (+0000) Subject: Some unicode fixes. X-Git-Tag: live~337 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/50d5fd554fe0f2633459ba3e8e57674869ba1643?ds=sidebyside Some unicode fixes. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@976 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/models/base.py b/forum/models/base.py index 2609106..1111b43 100644 --- a/forum/models/base.py +++ b/forum/models/base.py @@ -162,7 +162,7 @@ class CachedQuerySet(models.query.QuerySet): yield row def _get_query_hash(self): - return md5(str(self.query)).hexdigest() + return md5(unicode(self.query).encode("utf-8")).hexdigest() diff --git a/forum/models/node.py b/forum/models/node.py index afb04cf..bf82708 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -382,10 +382,10 @@ class Node(BaseModel, NodeContent): return None else: if self._original_state['tagnames']: - old_tags = set(name for name in self._original_state['tagnames'].split(u' ')) + old_tags = set(self._original_state['tagnames'].split()) else: old_tags = set() - new_tags = set(name for name in self.tagnames.split(u' ') if name) + new_tags = set(self.tagnames.split()) return dict( current=list(new_tags), diff --git a/forum/models/tag.py b/forum/models/tag.py index 5592c4b..912697b 100644 --- a/forum/models/tag.py +++ b/forum/models/tag.py @@ -27,7 +27,7 @@ class Tag(BaseModel): app_label = 'forum' def __unicode__(self): - return smart_unicode(self.name) + return unicode(self.name) def add_to_usage_count(self, value): if self.used_count + value < 0: