mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 17:33:44 +00:00
Oops. Dict is mutable object. Fix it. (values)
This commit is contained in:
parent
b966a87ade
commit
dcbaa6d561
1 changed files with 5 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ class MetaTelegramObject(type):
|
||||||
if not isinstance(base, MetaTelegramObject):
|
if not isinstance(base, MetaTelegramObject):
|
||||||
continue
|
continue
|
||||||
props.update(getattr(base, PROPS_ATTR_NAME))
|
props.update(getattr(base, PROPS_ATTR_NAME))
|
||||||
values.update(getattr(base, VALUES_ATTR_NAME))
|
# values.update(getattr(base, VALUES_ATTR_NAME))
|
||||||
aliases.update(getattr(base, ALIASES_ATTR_NAME))
|
aliases.update(getattr(base, ALIASES_ATTR_NAME))
|
||||||
|
|
||||||
# Scan current object for props
|
# Scan current object for props
|
||||||
|
|
@ -50,7 +50,7 @@ class MetaTelegramObject(type):
|
||||||
|
|
||||||
# Set attributes
|
# Set attributes
|
||||||
setattr(cls, PROPS_ATTR_NAME, props)
|
setattr(cls, PROPS_ATTR_NAME, props)
|
||||||
setattr(cls, VALUES_ATTR_NAME, values)
|
# setattr(cls, VALUES_ATTR_NAME, values)
|
||||||
setattr(cls, ALIASES_ATTR_NAME, aliases)
|
setattr(cls, ALIASES_ATTR_NAME, aliases)
|
||||||
|
|
||||||
mcs._objects[cls.__name__] = cls
|
mcs._objects[cls.__name__] = cls
|
||||||
|
|
@ -111,7 +111,9 @@ class TelegramObject(metaclass=MetaTelegramObject):
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return getattr(self, VALUES_ATTR_NAME, {})
|
if not hasattr(self, VALUES_ATTR_NAME):
|
||||||
|
setattr(self, VALUES_ATTR_NAME, {})
|
||||||
|
return getattr(self, VALUES_ATTR_NAME)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def telegram_types(self):
|
def telegram_types(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue