mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
makes attributeproperties object-aware, part 2
This commit is contained in:
parent
da0e380fa5
commit
6fca198a70
1 changed files with 2 additions and 14 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue