diff options
author | Tom Prince <tom.prince@ualberta.net> | 2012-01-28 19:10:58 -0500 |
---|---|---|
committer | Tom Prince <tom.prince@ualberta.net> | 2012-01-28 19:14:07 -0500 |
commit | 8337dacb008d48cd8de723921f8007276d3d7d3f (patch) | |
tree | 98b353c60ec5de552d272b3ad1ec3c89d6278e5e /alot/ui.py | |
parent | 5d0b77b26460e914a5e9990eab50b3638c369d6e (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.
Diffstat (limited to 'alot/ui.py')
-rw-r--r-- | alot/ui.py | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -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) |