summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-01-12 01:14:42 +0200
committerLV-426 <lv-426@taproot.org.il>2015-01-12 01:28:24 +0200
commitba8228ff3446729f9761b808ce8c1866bc0a6e68 (patch)
treea63f2b478ef4dfdda2ffa4e3bcefbab5289d1ac3 /src/server
parentbcc90ca12b0bb8a37a5ca6e1b72e6b4b629f0668 (diff)
rz_kernel: return: a tuple containing the input diff and the result of it's commit
Diffstat (limited to 'src/server')
-rw-r--r--src/server/rz_api_rest.py8
-rw-r--r--src/server/rz_kernel.py18
2 files changed, 19 insertions, 7 deletions
diff --git a/src/server/rz_api_rest.py b/src/server/rz_api_rest.py
index 4d0cbdc1..bad0cfa7 100644
--- a/src/server/rz_api_rest.py
+++ b/src/server/rz_api_rest.py
@@ -76,8 +76,8 @@ def diff_commit__topo():
try:
kernel = flask.current_app.kernel
- topo_diff = kernel.diff_commit__topo(topo_diff)
- return __common_resp_handle(data=topo_diff)
+ _, commit_ret = kernel.diff_commit__topo(topo_diff)
+ return __common_resp_handle(data=commit_ret)
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())
@@ -106,8 +106,8 @@ def diff_commit__attr():
try:
kernel = flask.current_app.kernel
- attr_diff = kernel.diff_commit__attr(attr_diff)
- return __common_resp_handle(data=attr_diff)
+ _, commit_ret = kernel.diff_commit__attr(attr_diff)
+ return __common_resp_handle(data=commit_ret)
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())
diff --git a/src/server/rz_kernel.py b/src/server/rz_kernel.py
index 41106ba5..925ebeaf 100644
--- a/src/server/rz_kernel.py
+++ b/src/server/rz_kernel.py
@@ -1,12 +1,14 @@
"""
Rhizi kernel, home to core operation login
"""
-import db_controller
import logging
import traceback
+
+import db_controller
from db_op import DBO_diff_commit__attr
from db_op import DBO_diff_commit__topo
+
log = logging.getLogger('rhizi')
class RZ_Kernel(object):
@@ -17,21 +19,31 @@ class RZ_Kernel(object):
- RESP API calls
- socket.io calls
- future interfaces
+
+ @return: a tuple containing the input diff and the result of it's commit
"""
op = DBO_diff_commit__topo(topo_diff)
try:
op_ret = self.db_ctl.exec_op(op)
- return op_ret
+ return topo_diff, op_ret
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())
raise e
def diff_commit__attr(self, attr_diff):
+ """
+ commit a graph attribute diff - this is a common pathway for:
+ - RESP API calls
+ - socket.io calls
+ - future interfaces
+
+ @return: a tuple containing the input diff and the result of it's commit
+ """
op = DBO_diff_commit__attr(attr_diff)
try:
op_ret = self.db_ctl.exec_op(op)
- return op_ret
+ return attr_diff, op_ret
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())