summaryrefslogtreecommitdiff
path: root/alot/ui.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-07-17 11:31:12 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-07-26 10:32:39 -0700
commitab6f986e0df10a1d260aea869745e43369a63ace (patch)
treed301cbbc6ee896094673c2e62c3e4195553fb3fc /alot/ui.py
parentf1e225cbb571920bb6d17f6ff15013f2c69c6c6c (diff)
ui: Handle asyncio coroutines in call_cmd
This allows twisted deferred's (which is all an inlineCallback actually is) to be mixed with asyncio coroutines (async def), by wrapping them in a special twisted function for handling asyncio coroutines.
Diffstat (limited to 'alot/ui.py')
-rw-r--r--alot/ui.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/alot/ui.py b/alot/ui.py
index f4b0dc3a..3a377cfd 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -707,6 +707,8 @@ class UI(object):
# call cmd.apply
def call_apply(_):
+ if asyncio.iscoroutinefunction(cmd.apply):
+ return defer.ensureDeferred(cmd.apply(self))
return defer.maybeDeferred(cmd.apply, self)
prehook = cmd.prehook or (lambda **kwargs: None)