aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2014-11-17 07:11:44 +0200
committerMatt Molyneaux <moggers87+git@moggers87.co.uk>2014-11-22 18:12:19 +0000
commit9d85dcdf11d3229625d1860a13db44d8d450347c (patch)
treeb4f7a8ce0cbe967800fa40e79a3f3948b3df7052 /mediagoblin/db/models.py
parent9c602458d830c1ebcd0ede7c14f7ddef79e2a73f (diff)
downloadmediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.tar.lz
mediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.tar.xz
mediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.zip
Fix unicode handling in "gmg addmedia".
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 12757eda..8f722cff 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -489,7 +489,11 @@ class MediaEntry(Base, MediaEntryMixin):
return import_component(self.media_type + '.models:BACKREF_NAME')
def __repr__(self):
- safe_title = self.title.encode('ascii', 'replace')
+ if six.PY2:
+ # obj.__repr__() should return a str on Python 2
+ safe_title = self.title.encode('utf-8', 'replace')
+ else:
+ safe_title = self.title
return '<{classname} {id}: {title}>'.format(
classname=self.__class__.__name__,