From 45578d0106d9415c0d721e1e1bcb9a0f9da03478 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 13 May 2018 14:50:48 +0200 Subject: [PATCH] Unittests pass --- evennia/utils/spawner.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/evennia/utils/spawner.py b/evennia/utils/spawner.py index c63ddaf868..aa62a1dcad 100644 --- a/evennia/utils/spawner.py +++ b/evennia/utils/spawner.py @@ -192,19 +192,19 @@ for mod in settings.PROTOTYPEFUNC_MODULES: # Helper functions -def olcfunc_parser(value, available_functions=None, **kwargs): +def protfunc_parser(value, available_functions=None, **kwargs): """ This is intended to be used by the in-game olc mechanism. It will parse the prototype - value for function tokens like `$olcfunc(arg, arg, ...)`. These functions behave all the + value for function tokens like `$protfunc(arg, arg, ...)`. These functions behave all the parameters of `inlinefuncs` but they are *not* passed a Session since this is not guaranteed to be available at the time of spawning. They may also return other structures than strings. - Available olcfuncs are specified as callables in one of the modules of + Available protfuncs are specified as callables in one of the modules of `settings.PROTOTYPEFUNC_MODULES`, or specified on the command line. Args: - value (string): The value to test for a parseable olcfunc. - available_functions (dict, optional): Mapping of name:olcfunction to use for this parsing. + value (string): The value to test for a parseable protfunc. + available_functions (dict, optional): Mapping of name:protfunction to use for this parsing. Kwargs: any (any): Passed on to the inlinefunc. @@ -215,7 +215,7 @@ def olcfunc_parser(value, available_functions=None, **kwargs): it to the prototype directly. """ - if not isinstance(basestring, value): + if not isinstance(value, basestring): return value available_functions = _PROTOTYPEFUNCS if available_functions is None else available_functions return inlinefuncs.parse_inlinefunc(value, _available_funcs=available_functions) @@ -246,6 +246,7 @@ def validate_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())