From e54fb1c3d5bf0b331c3c7e43133481e91f145143 Mon Sep 17 00:00:00 2001 From: Vincent Le Goff Date: Sun, 6 Jan 2019 21:27:19 +0100 Subject: [PATCH 1/2] Fix a slight error in search with candidates --- evennia/objects/objects.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index e4b0b80639..8cc4c4e3d0 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -427,6 +427,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): # only allow exact matching if searching the entire database # or unique #dbrefs exact = True + candidates = None elif candidates is None: # no custom candidates given - get them automatically if location: From 9e557418188feda0952af4145d97a602ad1a6a83 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 17 Jan 2019 23:03:11 +0100 Subject: [PATCH 2/2] Correct use of callable in prototype creation --- evennia/prototypes/prototypes.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/evennia/prototypes/prototypes.py b/evennia/prototypes/prototypes.py index a3281777e0..178b8384a0 100644 --- a/evennia/prototypes/prototypes.py +++ b/evennia/prototypes/prototypes.py @@ -293,6 +293,7 @@ def search_prototype(key=None, tags=None): if tagset.intersection(prototype.get("prototype_tags", []))} else: mod_matches = _MODULE_PROTOTYPES + if key: if key in mod_matches: # exact match @@ -565,11 +566,7 @@ def protfunc_parser(value, available_functions=None, testing=False, stacktrace=F """ if not isinstance(value, basestring): - try: - value = value.dbref - except AttributeError: - pass - value = to_str(value, force_string=True) + return value available_functions = PROT_FUNCS if available_functions is None else available_functions @@ -728,16 +725,16 @@ def init_spawn_value(value, validator=None): any (any): The (potentially pre-processed value to use for this prototype key) """ - value = protfunc_parser(value) validator = validator if validator else lambda o: o if callable(value): - return validator(value()) + value = validator(value()) elif value and is_iter(value) and callable(value[0]): # a structure (callable, (args, )) args = value[1:] - return validator(value[0](*make_iter(args))) + value = validator(value[0](*make_iter(args))) else: - return validator(value) + value = validator(value) + return protfunc_parser(value) def value_to_obj_or_any(value):