mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Don't accept indexed arguments in FSMProxy methods
This commit is contained in:
parent
8165297a02
commit
218936d09e
1 changed files with 8 additions and 2 deletions
|
@ -33,10 +33,16 @@ class FSMProxy(object):
|
|||
def make_proxy(fsm, event):
|
||||
fn = getattr(fsm, event)
|
||||
|
||||
def proxy():
|
||||
fn()
|
||||
def proxy(*args, **kwargs):
|
||||
if len(args) > 0:
|
||||
raise FSMProxyError('FSMProxy event listeners only accept named arguments.')
|
||||
fn(**kwargs)
|
||||
return proxy
|
||||
|
||||
for event in events:
|
||||
if not hasattr(self, event):
|
||||
setattr(self, event, make_proxy(fsm, event))
|
||||
|
||||
|
||||
class FSMProxyError(Exception):
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue