diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-07-17 11:31:12 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-07-26 10:32:39 -0700 |
commit | ab6f986e0df10a1d260aea869745e43369a63ace (patch) | |
tree | d301cbbc6ee896094673c2e62c3e4195553fb3fc /alot/ui.py | |
parent | f1e225cbb571920bb6d17f6ff15013f2c69c6c6c (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.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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) |