Skip to content

Commit

Permalink
Interpreter.queue only accepts Event instances
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Jan 20, 2016
1 parent 4c50811 commit 7cfe999
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sismic/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ def queue(self, event: model.Event):
external_event = model.Event(event.name, **event.data)
for bound_callable in self._bound:
bound_callable(external_event)
else:
elif isinstance(event, model.Event):
self._events.append(event)
else:
raise ValueError('{} is not an Event instance'.format(event))
return self

def execute(self, max_steps: int=-1) -> list:
Expand Down Expand Up @@ -227,7 +229,7 @@ def _select_transitions(self, event: model.Event=None) -> list:

# Retrieve the firable transitions for all active state
for transition in self._statechart.transitions:
if (transition.event == getattr(event, 'name', None) and transition.source in self._configuration and
if (transition.event == event.name and transition.source in self._configuration and
(transition.guard is None or self._evaluator.evaluate_guard(transition, event))):
transitions.add(transition)

Expand Down

0 comments on commit 7cfe999

Please sign in to comment.