Merge pull request #3753 from JohniFi/fix-init_evennia_properties-include-parent

Let init_evennia_properties() also init properties of parent classes
This commit is contained in:
Griatch 2025-04-26 11:55:29 +02:00 committed by GitHub
commit b7e239e138
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