This commit is contained in:
Griatch 2013-03-09 12:16:50 +01:00
commit 406800f254
8 changed files with 60 additions and 30 deletions

View file

@ -42,7 +42,7 @@ from django.conf import settings
from src.comms.channelhandler import CHANNELHANDLER
from src.utils import logger, utils
from src.commands.cmdparser import at_multimatch_cmd
from src.utils.utils import string_suggestions
from src.utils.utils import string_suggestions, make_iter
from django.utils.translation import ugettext as _
@ -254,7 +254,7 @@ def cmdhandler(caller, raw_string, testing=False, sessid=None):
cmd.raw_string = unformatted_raw_string
if hasattr(cmd, 'obj') and hasattr(cmd.obj, 'scripts'):
# cmd.obj are automatically made available.
# cmd.obj is automatically made available.
# we make sure to validate its scripts.
yield cmd.obj.scripts.validate()
@ -270,6 +270,13 @@ def cmdhandler(caller, raw_string, testing=False, sessid=None):
# (return value is normally None)
ret = yield cmd.func()
if hasattr(cmd, "func_parts"):
# yield on command parts (for multi-part delayed commands)
for func_part in make_iter(cmd.func_parts):
err = yield func_part()
# returning anything but a deferred/None will kill the chain
if err: break
# post-command hook
yield cmd.at_post_cmd()