From eeaf1d3f5881110455936076fcd8a0d1ba6d45ad Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 2 Aug 2022 16:06:40 +0200 Subject: [PATCH] Fix syscommand regression (see #2755) --- evennia/commands/cmdset.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/evennia/commands/cmdset.py b/evennia/commands/cmdset.py index 9d8877a679..8607a4a372 100644 --- a/evennia/commands/cmdset.py +++ b/evennia/commands/cmdset.py @@ -27,6 +27,7 @@ Set theory. """ from weakref import WeakKeyDictionary + from django.utils.translation import gettext as _ from evennia.utils.utils import inherits_from, is_iter @@ -571,9 +572,13 @@ class CmdSet(object, metaclass=_CmdSetMeta): """ if isinstance(cmd, str): - cmd = next((_cmd for _cmd in self.commands if _cmd.key == cmd), None) - if cmd is None: - return None + _cmd = next((_cmd for _cmd in self.commands if _cmd.key == cmd), None) + if _cmd is None: + if not cmd.startswith("__"): + # if a syscommand, keep the original string and instantiate on it + return None + else: + cmd = _cmd cmd = self._instantiate(cmd) if cmd.key.startswith("__"): @@ -599,9 +604,13 @@ class CmdSet(object, metaclass=_CmdSetMeta): """ if isinstance(cmd, str): - cmd = next((_cmd for _cmd in self.commands if _cmd.key == cmd), None) - if cmd is None: - return None + _cmd = next((_cmd for _cmd in self.commands if _cmd.key == cmd), None) + if _cmd is None: + if not cmd.startswith("__"): + # if a syscommand, keep the original string and instantiate on it + return None + else: + cmd = _cmd cmd = self._instantiate(cmd) for thiscmd in self.commands: