refactoring to rest app, fixed removal of simple update state logic that was causing a loop for CoreClient
This commit is contained in:
parent
46730ce216
commit
2593d97cab
5 changed files with 77 additions and 162 deletions
23
webapp/core_utils.py
Normal file
23
webapp/core_utils.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from bottle import abort
|
||||
|
||||
|
||||
def get_session(coreemu, session_id):
|
||||
session = coreemu.sessions.get(session_id)
|
||||
if not session:
|
||||
abort(404, "session does not exist")
|
||||
return session
|
||||
|
||||
|
||||
def get_node(session, node_id):
|
||||
if node_id.isdigit():
|
||||
node_id = int(node_id)
|
||||
node = session.objects.get(node_id)
|
||||
if not node:
|
||||
abort(404, "node does not exist")
|
||||
return node
|
||||
|
||||
|
||||
def get_node_id(node_id):
|
||||
if node_id.isdigit():
|
||||
node_id = int(node_id)
|
||||
return node_id
|
Loading…
Add table
Add a link
Reference in a new issue