TelegramObject.to_dict(): cover cases where value is 0 or empty object

This commit is contained in:
Noam Meltzer 2016-04-25 14:30:51 +03:00
parent 3f28633e79
commit f107070db2

View file

@ -66,7 +66,7 @@ class TelegramObject(object):
for key in iter(self.__dict__): for key in iter(self.__dict__):
value = self.__dict__[key] value = self.__dict__[key]
if value or value == '': if value is not None:
if hasattr(value, 'to_dict'): if hasattr(value, 'to_dict'):
data[key] = value.to_dict() data[key] = value.to_dict()
else: else: