Commit 7099e42e authored by payno's avatar payno

[node] manage case handler is already instanciate

parent 4513c7e7
......@@ -166,6 +166,7 @@ class Node(object):
self._handlers.clear()
self._input_type_to_name.clear()
self._output_type_to_name.clear()
assert self._process_pt is not None
if callable(self._process_pt):
self.__process_instance = self._process_pt
......@@ -249,9 +250,15 @@ class Node(object):
raise ValueError('no function set properties found')
if input_name in node.handlers:
out = getattr(node.__process_instance, node.handlers[input_name])(input_data)
if type(node.handlers[input_name]) is str:
out = getattr(node.__process_instance, node.handlers[input_name])(input_data)
else:
out = node.handlers[input_name](input_data)
elif None in node.handlers:
out = getattr(node.__process_instance, node.handlers[None])(input_data)
if type(node.handlers[None]) is str:
out = getattr(node.__process_instance, node.handlers[None])(input_data)
else:
out = node.__process_instance(input_data)
else:
err = '"{0}" channel is not managed by {1}'.format(input_name, node._process_pt)
raise KeyError(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment