From 389a212c63344e9c93c141cf5bc2a1f45c2df58b Mon Sep 17 00:00:00 2001 From: Wendy Wang Date: Mon, 23 Sep 2024 18:36:50 +0200 Subject: [PATCH 1/2] Fix for #3622 - check if attr.strvalue exists --- evennia/commands/default/building.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index cffd59a6a6..22d96e61f3 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -2831,7 +2831,7 @@ class CmdExamine(ObjManipCommand): key, category, value = attr.db_key, attr.db_category, attr.value valuetype = "" - if value is None and attr.strvalue is not None: + if value is None and getattr(attr, "strvalue", None) is not None: value = attr.strvalue valuetype = " |B[strvalue]|n" typ = self._get_attribute_value_type(value) @@ -2850,7 +2850,7 @@ class CmdExamine(ObjManipCommand): key, category, value = attr.db_key, attr.db_category, attr.value valuetype = "" - if value is None and attr.strvalue is not None: + if value is None and getattr(attr, "strvalue", None) is not None: value = attr.strvalue valuetype = " |B[strvalue]|n" typ = self._get_attribute_value_type(value) From 3a093e134c02b50fd0e0b6d969f5908bc878bd2c Mon Sep 17 00:00:00 2001 From: Wendy Wang Date: Fri, 27 Sep 2024 23:04:30 +0200 Subject: [PATCH 2/2] Default db_strvalue to None if nonexistent --- evennia/commands/default/building.py | 4 ++-- evennia/typeclasses/attributes.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 22d96e61f3..cffd59a6a6 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -2831,7 +2831,7 @@ class CmdExamine(ObjManipCommand): key, category, value = attr.db_key, attr.db_category, attr.value valuetype = "" - if value is None and getattr(attr, "strvalue", None) is not None: + if value is None and attr.strvalue is not None: value = attr.strvalue valuetype = " |B[strvalue]|n" typ = self._get_attribute_value_type(value) @@ -2850,7 +2850,7 @@ class CmdExamine(ObjManipCommand): key, category, value = attr.db_key, attr.db_category, attr.value valuetype = "" - if value is None and getattr(attr, "strvalue", None) is not None: + if value is None and attr.strvalue is not None: value = attr.strvalue valuetype = " |B[strvalue]|n" typ = self._get_attribute_value_type(value) diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index 174b9ab056..419e0cd3d3 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -62,7 +62,7 @@ class IAttribute: return LockHandler(self) key = property(lambda self: self.db_key) - strvalue = property(lambda self: self.db_strvalue) + strvalue = property(lambda self: getattr(self, 'db_strvalue', None)) category = property(lambda self: self.db_category) model = property(lambda self: self.db_model) attrtype = property(lambda self: self.db_attrtype)