fix repr() and str() on File-based objects
This commit is contained in:
parent
7411e729e6
commit
ab7057b038
3 changed files with 7 additions and 6 deletions
|
|
@ -38,6 +38,12 @@ class BaseFile(CapBaseObject):
|
||||||
rating = Field('Rating', int, long, float, default=NotAvailable)
|
rating = Field('Rating', int, long, float, default=NotAvailable)
|
||||||
rating_max = Field('Maximum 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
|
@classmethod
|
||||||
def id2url(cls, _id):
|
def id2url(cls, _id):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,6 @@ class BaseImage(_BaseImage):
|
||||||
thumbnail = Field('Thumbnail of the image', _BaseImage)
|
thumbnail = Field('Thumbnail of the image', _BaseImage)
|
||||||
data = BytesField('Data of image')
|
data = BytesField('Data of image')
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.url
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return '<Image url="%s">' % self.url
|
|
||||||
|
|
||||||
def __iscomplete__(self):
|
def __iscomplete__(self):
|
||||||
return self.data is not NotLoaded
|
return self.data is not NotLoaded
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class BaseVideo(BaseImage):
|
||||||
"""
|
"""
|
||||||
duration = Field('file duration', int, long, timedelta)
|
duration = Field('file duration', int, long, timedelta)
|
||||||
|
|
||||||
|
|
||||||
class ICapVideo(ICapImage):
|
class ICapVideo(ICapImage):
|
||||||
"""
|
"""
|
||||||
Video file provider.
|
Video file provider.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue