mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added a string representation (__str__) for JsonDeserializable
This commit is contained in:
parent
3c8faa155f
commit
cf61577e3e
@ -68,6 +68,16 @@ class JsonDeserializable:
|
|||||||
else:
|
else:
|
||||||
raise ValueError("json_type should be a json dict or string.")
|
raise ValueError("json_type should be a json dict or string.")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
d = {}
|
||||||
|
for x, y in self.__dict__.iteritems():
|
||||||
|
if hasattr(y, '__dict__'):
|
||||||
|
d[x] = y.__dict__
|
||||||
|
else:
|
||||||
|
d[x] = y
|
||||||
|
|
||||||
|
return unicode(d)
|
||||||
|
|
||||||
|
|
||||||
class User(JsonDeserializable):
|
class User(JsonDeserializable):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user