Merge branch 'master' into develop
This commit is contained in:
commit
0f7d29783e
3 changed files with 17 additions and 5 deletions
|
|
@ -333,7 +333,7 @@ def objlist(*args, **kwargs):
|
||||||
def dbref(*args, **kwargs):
|
def dbref(*args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Usage $dbref(<#dbref>)
|
Usage $dbref(<#dbref>)
|
||||||
Returns one Object searched globally by #dbref. Error if #dbref is invalid.
|
Validate that a #dbref input is valid.
|
||||||
"""
|
"""
|
||||||
if not args or len(args) < 1 or _RE_DBREF.match(args[0]) is None:
|
if not args or len(args) < 1 or _RE_DBREF.match(args[0]) is None:
|
||||||
raise ValueError('$dbref requires a valid #dbref argument.')
|
raise ValueError('$dbref requires a valid #dbref argument.')
|
||||||
|
|
|
||||||
|
|
@ -673,8 +673,10 @@ def spawn(*prototypes, **kwargs):
|
||||||
prototype_parents (dict): A dictionary holding a custom
|
prototype_parents (dict): A dictionary holding a custom
|
||||||
prototype-parent dictionary. Will overload same-named
|
prototype-parent dictionary. Will overload same-named
|
||||||
prototypes from prototype_modules.
|
prototypes from prototype_modules.
|
||||||
return_parents (bool): Only return a dict of the
|
return_parents (bool): Return a dict of the entire prototype-parent tree
|
||||||
prototype-parents (no object creation happens)
|
available to this prototype (no object creation happens). This is a
|
||||||
|
merged result between the globally found protparents and whatever
|
||||||
|
custom `prototype_parents` are given to this function.
|
||||||
only_validate (bool): Only run validation of prototype/parents
|
only_validate (bool): Only run validation of prototype/parents
|
||||||
(no object creation) and return the create-kwargs.
|
(no object creation) and return the create-kwargs.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,9 @@ class AttributeHandler(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ret = []
|
ret = []
|
||||||
|
category = category.strip().lower() if category is not None else None
|
||||||
for keystr in make_iter(key):
|
for keystr in make_iter(key):
|
||||||
|
keystr = key.strip().lower()
|
||||||
ret.extend(bool(attr) for attr in self._getcache(keystr, category))
|
ret.extend(bool(attr) for attr in self._getcache(keystr, category))
|
||||||
return ret[0] if len(ret) == 1 else ret
|
return ret[0] if len(ret) == 1 else ret
|
||||||
|
|
||||||
|
|
@ -605,7 +607,8 @@ class AttributeHandler(object):
|
||||||
Remove attribute or a list of attributes from object.
|
Remove attribute or a list of attributes from object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
key (str): An Attribute key to remove.
|
key (str or list): An Attribute key to remove or a list of keys. If
|
||||||
|
multiple keys, they must all be of the same `category`.
|
||||||
raise_exception (bool, optional): If set, not finding the
|
raise_exception (bool, optional): If set, not finding the
|
||||||
Attribute to delete will raise an exception instead of
|
Attribute to delete will raise an exception instead of
|
||||||
just quietly failing.
|
just quietly failing.
|
||||||
|
|
@ -623,7 +626,11 @@ class AttributeHandler(object):
|
||||||
was found matching `key`.
|
was found matching `key`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
category = category.strip().lower() if category is not None else None
|
||||||
|
|
||||||
for keystr in make_iter(key):
|
for keystr in make_iter(key):
|
||||||
|
keystr = keystr.lower()
|
||||||
|
|
||||||
attr_objs = self._getcache(keystr, category)
|
attr_objs = self._getcache(keystr, category)
|
||||||
for attr_obj in attr_objs:
|
for attr_obj in attr_objs:
|
||||||
if not (
|
if not (
|
||||||
|
|
@ -634,10 +641,11 @@ class AttributeHandler(object):
|
||||||
try:
|
try:
|
||||||
attr_obj.delete()
|
attr_obj.delete()
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
|
print("Assertionerror for attr.delete()")
|
||||||
# this happens if the attr was already deleted
|
# this happens if the attr was already deleted
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
self._delcache(key, category)
|
self._delcache(keystr, category)
|
||||||
if not attr_objs and raise_exception:
|
if not attr_objs and raise_exception:
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
|
||||||
|
|
@ -655,6 +663,8 @@ class AttributeHandler(object):
|
||||||
type `attredit` on the Attribute in question.
|
type `attredit` on the Attribute in question.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
category = category.strip().lower() if category is not None else None
|
||||||
|
|
||||||
if not self._cache_complete:
|
if not self._cache_complete:
|
||||||
self._fullcache()
|
self._fullcache()
|
||||||
if accessing_obj:
|
if accessing_obj:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue