From 6fca198a70dac42e6283332e0b295e6a4d3c9fe1 Mon Sep 17 00:00:00 2001 From: Tegiminis Date: Sun, 10 Jul 2022 03:20:16 -0700 Subject: [PATCH] makes attributeproperties object-aware, part 2 --- evennia/typeclasses/attributes.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index 9917b351b8..2e801b5bce 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -218,7 +218,6 @@ class AttributeProperty: """ value = self._default try: -<<<<<<< HEAD value = self.at_get(getattr(instance, self.attrhandler_name).get( key=self._key, default=self._default, @@ -226,17 +225,6 @@ class AttributeProperty: strattr=self._strattr, raise_exception=self._autocreate, ), instance) -======= - value = self.at_get( - getattr(instance, self.attrhandler_name).get( - key=self._key, - default=self._default, - category=self._category, - strattr=self._strattr, - raise_exception=self._autocreate, - ) - ) ->>>>>>> ce3992f999a164881462d8f878d71a47a8f946cc except AttributeError: if self._autocreate: # attribute didn't exist and autocreate is set @@ -253,7 +241,7 @@ class AttributeProperty: ( getattr(instance, self.attrhandler_name).add( self._key, - self.at_set(value), + self.at_set(value, instance), category=self._category, lockstring=self._lockstring, strattr=self._strattr, @@ -269,7 +257,7 @@ class AttributeProperty: """ getattr(instance, self.attrhandler_name).remove(key=self._key, category=self._category) - def at_set(self, value): + def at_set(self, value, obj): """ The value to set is passed through the method. It can be used to customize/validate the input in a custom child class.