Removed SEARCH_AT_MULTIMATCH_INPUT and SEARCH_AT_MULTIMATCH_CMD settings and connected functions - these are no longer individually overloadable. SEARCH_AT_RESULT function now handles all error reporting. Also added SEARCH_MULTIMATCH_SEPARATOR to make it easy to replace the character used to separate multi-matches (1-box, 2-box is using '-' by default), in response to #795. Also moved the default SEARCH_AT_RESULT function from the cmdparser to evennia.utils.utils.

This commit is contained in:
Griatch 2015-09-27 13:05:29 +02:00
parent 5429ede5f7
commit 2743f98fb0
10 changed files with 116 additions and 199 deletions

View file

@ -71,7 +71,7 @@ CMD_CHANNEL = "__send_to_channel_command"
CMD_LOGINSTART = "__unloggedin_look_command"
# Function for handling multiple command matches.
_AT_MULTIMATCH_CMD = utils.variable_from_module(*settings.SEARCH_AT_MULTIMATCH_CMD.rsplit('.', 1))
_SEARCH_AT_RESULT = utils.variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1))
# Output strings
@ -488,7 +488,7 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
syscmd.matches = matches
else:
# fall back to default error handling
sysarg = yield _AT_MULTIMATCH_CMD(caller, matches)
sysarg = yield _SEARCH_AT_RESULT([match[2] for match in matches], caller, query=match[0])
raise ExecSystemCommand(syscmd, sysarg)
if len(matches) == 1: