From 185a9e99186892ef3bbaf8fb06962e1c06d90e38 Mon Sep 17 00:00:00 2001 From: leandrotoledo Date: Mon, 20 Jul 2015 08:01:14 -0300 Subject: [PATCH] Fixes bug when to_data thumb for document and video --- telegram/document.py | 5 +++-- telegram/video.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/telegram/document.py b/telegram/document.py index 14cc1efdb..364a3f983 100644 --- a/telegram/document.py +++ b/telegram/document.py @@ -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: diff --git a/telegram/video.py b/telegram/video.py index e4690631c..b21c400a2 100644 --- a/telegram/video.py +++ b/telegram/video.py @@ -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: