Skip to content
Snippets Groups Projects
Commit aa61ea9e authored by Philipp Schillinger's avatar Philipp Schillinger
Browse files

Prevent module caching in Python parser to fix state reloading

(see #61)
parent c69ccc0a
Branches
Tags
No related merge requests found
...@@ -101,9 +101,9 @@ IO.PackageParser = new (function() { ...@@ -101,9 +101,9 @@ IO.PackageParser = new (function() {
if (state_def != undefined) { if (state_def != undefined) {
state_def.setFilePath(entry); state_def.setFilePath(entry);
WS.Statelib.updateDef(state_def); WS.Statelib.updateDef(state_def);
T.logInfo("Updating changed definition for state: " + state_def.getStateClass()); T.logInfo("Updating changed definition for state: " + state_def.getStateType());
var update_states = Behavior.getStatemachine().traverseStates(function(state) { var update_states = Behavior.getStatemachine().traverseStates(function(state) {
return state.getStateClass() == state_def.getStateClass(); return state.getStateType() == state_def.getStateType();
}); });
update_states.forEach(function (state) { update_states.forEach(function (state) {
state.updateStateDefinition(state_def); state.updateStateDefinition(state_def);
......
...@@ -19,6 +19,7 @@ for data in iter(sys.stdin.readline, ""): ...@@ -19,6 +19,7 @@ for data in iter(sys.stdin.readline, ""):
result = {'id': request['id'], 'state_defs': state_defs} result = {'id': request['id'], 'state_defs': state_defs}
try: try:
pkg = __import__(request['import_path'], fromlist=[request['import_path']]) pkg = __import__(request['import_path'], fromlist=[request['import_path']])
del sys.modules[pkg.__name__] # prevent module caching (to allow state reloading)
def is_state(member): def is_state(member):
return (inspect.isclass(member) and return (inspect.isclass(member) and
member.__module__ == pkg.__name__ and member.__module__ == pkg.__name__ and
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment