mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
Changes bare try/except to callable check.
This commit is contained in:
parent
86fcdf4528
commit
470c2ebef7
1 changed files with 4 additions and 4 deletions
|
|
@ -176,7 +176,7 @@ class AttributeProperty:
|
|||
|
||||
attrhandler_name = "attributes"
|
||||
|
||||
def __init__(self, default=None, category=None, strattr=False, lockstring="", autocreate=True):
|
||||
def __init__(self, default=None, default_factory=None, category=None, strattr=False, lockstring="", autocreate=True):
|
||||
"""
|
||||
Initialize an Attribute as a property descriptor.
|
||||
|
||||
|
|
@ -209,10 +209,10 @@ class AttributeProperty:
|
|||
Tries returning a new instance of default if callable.
|
||||
|
||||
"""
|
||||
try:
|
||||
if callable(self.__default):
|
||||
return self.__default()
|
||||
except:
|
||||
return self.__default
|
||||
|
||||
return self.__default
|
||||
|
||||
@_default.setter
|
||||
def _default(self, value):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue