summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Prince <tom.prince@ualberta.net>2012-01-28 19:10:58 -0500
committerTom Prince <tom.prince@ualberta.net>2012-01-28 19:14:07 -0500
commit8337dacb008d48cd8de723921f8007276d3d7d3f (patch)
tree98b353c60ec5de552d272b3ad1ec3c89d6278e5e
parent5d0b77b26460e914a5e9990eab50b3638c369d6e (diff)
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.
-rw-r--r--alot/ui.py13
1 files changed, 3 insertions, 10 deletions
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)