mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-26 01:42:34 +00:00
workflow: allow more arguments to the import workflow
Allows to use stateful message handlers ```python wire.add(MessageType.MoneroTransactionSign, __name__, "get_address", STATE) ```
This commit is contained in:
parent
b23077b707
commit
5b5b593eb3
@ -165,11 +165,11 @@ async def protobuf_workflow(ctx, reader, handler, *args):
|
|||||||
await ctx.write(res)
|
await ctx.write(res)
|
||||||
|
|
||||||
|
|
||||||
def import_workflow(ctx, req, pkgname, modname):
|
def import_workflow(ctx, req, pkgname, modname, *args):
|
||||||
modpath = "%s.%s" % (pkgname, modname)
|
modpath = "%s.%s" % (pkgname, modname)
|
||||||
module = __import__(modpath, None, None, (modname,), 0)
|
module = __import__(modpath, None, None, (modname,), 0)
|
||||||
handler = getattr(module, modname)
|
handler = getattr(module, modname)
|
||||||
return handler(ctx, req)
|
return handler(ctx, req, *args)
|
||||||
|
|
||||||
|
|
||||||
async def unexpected_msg(ctx, reader):
|
async def unexpected_msg(ctx, reader):
|
||||||
|
Loading…
Reference in New Issue
Block a user