Added more yields to cmdhandler, removed unnecessary callback to return.
This commit is contained in:
parent
ab2ba19782
commit
562a32107e
1 changed files with 8 additions and 8 deletions
|
|
@ -248,10 +248,9 @@ def cmdhandler(caller, raw_string, testing=False):
|
||||||
else:
|
else:
|
||||||
caller.ndb.last_cmd = None
|
caller.ndb.last_cmd = None
|
||||||
|
|
||||||
# Done! By default, Evennia does not use this return at all
|
# Done! This returns a deferred. By default, Evennia does
|
||||||
def callback(r):
|
# not use this at all.
|
||||||
return r
|
returnValue(ret)
|
||||||
returnValue(ret).addCallback(r)
|
|
||||||
|
|
||||||
except ExecSystemCommand, exc:
|
except ExecSystemCommand, exc:
|
||||||
# Not a normal command: run a system command, if available,
|
# Not a normal command: run a system command, if available,
|
||||||
|
|
@ -267,16 +266,17 @@ def cmdhandler(caller, raw_string, testing=False):
|
||||||
if hasattr(syscmd, 'obj') and hasattr(syscmd.obj, 'scripts'):
|
if hasattr(syscmd, 'obj') and hasattr(syscmd.obj, 'scripts'):
|
||||||
# cmd.obj is automatically made available.
|
# cmd.obj is automatically made available.
|
||||||
# we make sure to validate its scripts.
|
# we make sure to validate its scripts.
|
||||||
syscmd.obj.scripts.validate()
|
yield syscmd.obj.scripts.validate()
|
||||||
|
|
||||||
if testing:
|
if testing:
|
||||||
# only return the command instance
|
# only return the command instance
|
||||||
returnValue(syscmd)
|
returnValue(syscmd)
|
||||||
|
|
||||||
# parse and run the command
|
# parse and run the command
|
||||||
syscmd.parse()
|
yield syscmd.parse()
|
||||||
syscmd.func()
|
yield syscmd.func()
|
||||||
elif sysarg:
|
elif sysarg:
|
||||||
|
# return system arg
|
||||||
caller.msg(exc.sysarg)
|
caller.msg(exc.sysarg)
|
||||||
|
|
||||||
except NoCmdSets:
|
except NoCmdSets:
|
||||||
|
|
@ -299,7 +299,7 @@ def cmdhandler(caller, raw_string, testing=False):
|
||||||
except Exception:
|
except Exception:
|
||||||
# This catches exceptions in cmdhandler exceptions themselves
|
# This catches exceptions in cmdhandler exceptions themselves
|
||||||
string = "%s\nAbove traceback is from a Command handler bug."
|
string = "%s\nAbove traceback is from a Command handler bug."
|
||||||
string += " Please contact an admin."
|
string += " Please contact an admin and/or file a bug report."
|
||||||
logger.log_trace(string)
|
logger.log_trace(string)
|
||||||
caller.msg(string % format_exc())
|
caller.msg(string % format_exc())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue