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.
This commit is contained in:
Joar Wandborg 2012-08-03 16:02:18 +02:00
parent 2891b2c6d0
commit 79f28e0b93

View File

@ -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):