From 8337dacb008d48cd8de723921f8007276d3d7d3f Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Sat, 28 Jan 2012 19:10:58 -0500 Subject: Always run post command hook. Before, the hook was only being run if the command returned a deferred. Now, it uses defer.maybeDeferred to handle things generically. --- alot/ui.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'alot/ui.py') diff --git a/alot/ui.py b/alot/ui.py index f7efbb4e..cf44c342 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -459,13 +459,6 @@ class UI(object): # call cmd.apply logging.debug('apply command: %s' % cmd) - try: - retval = cmd.apply(self) - # if we deal with a InlineCallbacks-decorated method, it - # instantly returns a defered. This adds call/errbacks to react - # to successful/erroneous termination of the defered apply() - if isinstance(retval, defer.Deferred): - retval.addErrback(errorHandler) - retval.addCallback(call_posthook) - except Exception, e: - errorHandler(Failure(e)) + d = defer.maybeDeferred(cmd.apply, self) + d.addErrback(errorHandler) + d.addCallback(call_posthook) -- cgit v1.2.3