From c121f4915ea48eed6573f5452384abe8ba51689e Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 7 Feb 2019 09:12:52 +0100 Subject: [PATCH 1/3] Update spawn doc to better explain `protparents` kwarg (see #1775) --- evennia/prototypes/spawner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evennia/prototypes/spawner.py b/evennia/prototypes/spawner.py index 2264cb13c7..2355da1321 100644 --- a/evennia/prototypes/spawner.py +++ b/evennia/prototypes/spawner.py @@ -673,8 +673,10 @@ def spawn(*prototypes, **kwargs): prototype_parents (dict): A dictionary holding a custom prototype-parent dictionary. Will overload same-named prototypes from prototype_modules. - return_parents (bool): Only return a dict of the - prototype-parents (no object creation happens) + return_parents (bool): Return a dict of the entire prototype-parent tree + 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 (no object creation) and return the create-kwargs. From 95604616a32478c3ab2d80d2747ec04fc93a1edf Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 7 Feb 2019 09:52:58 +0100 Subject: [PATCH 2/3] Correct docstring for $dbref protfunc --- evennia/prototypes/protfuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/prototypes/protfuncs.py b/evennia/prototypes/protfuncs.py index e222876221..30f590c189 100644 --- a/evennia/prototypes/protfuncs.py +++ b/evennia/prototypes/protfuncs.py @@ -333,7 +333,7 @@ def objlist(*args, **kwargs): def dbref(*args, **kwargs): """ 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: raise ValueError('$dbref requires a valid #dbref argument.') From c5a73174abb5611ea259cc51749633563b407465 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 7 Feb 2019 22:04:12 +0100 Subject: [PATCH 3/3] Fix bug in deleting capitalized attributes. Resolves #1776. --- evennia/typeclasses/attributes.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index 1dc1902494..432d703e4b 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -383,7 +383,9 @@ class AttributeHandler(object): """ ret = [] + category = category.strip().lower() if category is not None else None for keystr in make_iter(key): + keystr = key.strip().lower() ret.extend(bool(attr) for attr in self._getcache(keystr, category)) 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. 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 Attribute to delete will raise an exception instead of just quietly failing. @@ -623,7 +626,11 @@ class AttributeHandler(object): was found matching `key`. """ + category = category.strip().lower() if category is not None else None + for keystr in make_iter(key): + keystr = keystr.lower() + attr_objs = self._getcache(keystr, category) for attr_obj in attr_objs: if not ( @@ -634,10 +641,11 @@ class AttributeHandler(object): try: attr_obj.delete() except AssertionError: + print("Assertionerror for attr.delete()") # this happens if the attr was already deleted pass finally: - self._delcache(key, category) + self._delcache(keystr, category) if not attr_objs and raise_exception: raise AttributeError @@ -655,6 +663,8 @@ class AttributeHandler(object): type `attredit` on the Attribute in question. """ + category = category.strip().lower() if category is not None else None + if not self._cache_complete: self._fullcache() if accessing_obj: