aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-08-03 16:02:18 +0200
committerJoar Wandborg <git@wandborg.com>2012-08-03 16:02:18 +0200
commit79f28e0b938199b13515edbb8e4a3dd12a6ab6a1 (patch)
tree9c605ac3e077e6575a83b090fe3f303f62cb4bff
parent2891b2c6d0526f0faab78f182d3d084717e7691e (diff)
downloadmediagoblin-79f28e0b938199b13515edbb8e4a3dd12a6ab6a1.tar.lz
mediagoblin-79f28e0b938199b13515edbb8e4a3dd12a6ab6a1.tar.xz
mediagoblin-79f28e0b938199b13515edbb8e4a3dd12a6ab6a1.zip
Fixed a UnicodeError in the sql.models.MediaEntry
The __repr__() call would crash the process when it tried to convert an unicode title to ASCII for terminal/logfile output.
-rw-r--r--mediagoblin/db/sql/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 6ce4e06f..7c8c0f99 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -212,10 +212,12 @@ class MediaEntry(Base, MediaEntryMixin):
return sys.modules[models_module].DATA_MODEL
def __repr__(self):
+ safe_title = self.title.encode('ascii', 'replace')
+
return '<{classname} {id}: {title}>'.format(
classname=self.__class__.__name__,
id=self.id,
- title=self.title)
+ title=safe_title)
class FileKeynames(Base):