Update init_evennia_properties() to also init properties of parent classes

This commit is contained in:
JohniFi 2025-03-27 11:11:50 +01:00 committed by GitHub
parent 5b2963fc46
commit a38b179e51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -347,12 +347,21 @@ class TypedObject(SharedMemoryModel):
Called by creation methods; makes sure to initialize Attribute/TagProperties
by fetching them once.
"""
for propkey, prop in self.__class__.__dict__.items():
if isinstance(prop, (AttributeProperty, TagProperty, TagCategoryProperty)):
try:
getattr(self, propkey)
except Exception:
log_trace()
evennia_properties = set()
for base in type(self).__mro__:
evennia_properties.update(
{
propkey
for propkey, prop in vars(base).items()
if isinstance(prop, (AttributeProperty, TagProperty, TagCategoryProperty))
}
)
for propkey in evennia_properties:
try:
getattr(self, propkey)
except Exception:
log_trace()
# initialize all handlers in a lazy fashion
@lazy_property