Fixes bug when to_data thumb for document and video

This commit is contained in:
leandrotoledo 2015-07-20 08:01:14 -03:00
parent a1899a75e4
commit 185a9e9918
2 changed files with 6 additions and 4 deletions

View file

@ -32,8 +32,9 @@ class Document(TelegramObject):
file_size=data.get('file_size', None))
def to_dict(self):
data = {'file_id': self.file_id,
'thumb': self.thumb.to_dict()}
data = {'file_id': self.file_id}
if self.thumb:
data['thumb'] = self.thumb.to_dict()
if self.file_name:
data['file_name'] = self.file_name
if self.mime_type:

View file

@ -44,8 +44,9 @@ class Video(TelegramObject):
data = {'file_id': self.file_id,
'width': self.width,
'height': self.height,
'duration': self.duration,
'thumb': self.thumb.to_dict()}
'duration': self.duration}
if self.thumb:
data['thumb'] = self.thumb.to_dict()
if self.mime_type:
data['mime_type'] = self.mime_type
if self.file_size: