fix repr() and str() on File-based objects

This commit is contained in:
Romain Bignon 2014-07-05 17:20:53 +02:00
commit ab7057b038
3 changed files with 7 additions and 6 deletions

View file

@ -38,6 +38,12 @@ class BaseFile(CapBaseObject):
rating = Field('Rating', int, long, float, default=NotAvailable)
rating_max = Field('Maximum rating', int, long, float, default=NotAvailable)
def __str__(self):
return self.url or ''
def __repr__(self):
return '<%s title=%r url=%r>' % (type(self).__name__, self.title, self.url)
@classmethod
def id2url(cls, _id):
"""