From 79f28e0b938199b13515edbb8e4a3dd12a6ab6a1 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Fri, 3 Aug 2012 16:02:18 +0200 Subject: [PATCH] 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. --- mediagoblin/db/sql/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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): -- 2.25.1