summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-01-25 15:32:01 +0200
committerLV-426 <lv-426@taproot.org.il>2015-01-25 15:39:19 +0200
commitce486568f228e8160974c0e08f512617a2730fd3 (patch)
treea5b9733042ed9f0d2bc8c647d22314758481f527
parent5209295f675748dcdec7d0a44ff7081e0c44a8af (diff)
rz_mesh.py: fixing 'self' key error
-rw-r--r--src/server/rz_mesh.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/rz_mesh.py b/src/server/rz_mesh.py
index 507ca71a..edb9f4f7 100644
--- a/src/server/rz_mesh.py
+++ b/src/server/rz_mesh.py
@@ -95,11 +95,19 @@ def init_ws_interface(cfg, kernel, flask_webapp):
try:
# TODO: avoid stack inspection if possible
stack = inspect.stack()
- caller_class = stack[1][0].f_locals["self"].__class__
- if WebSocket_Graph_NS == caller_class:
+ stack_frame = stack[1][0]
+
+ obj_instance = stack_frame.f_locals.get('self')
+ if None != obj_instance:
# [!] no need emit broadcast if call originated from a websocket as
# WebSocket_Graph_NS#on_diff_commit__xxx emit their own self-excluding multicast
+ # we still asser call class == WebSocket_Graph_NS
+
+ caller_class = obj_instance.__class__
+ assert WebSocket_Graph_NS == caller_class, 'decorator__ws_multicast: unknown callpath: not from WebSocket_Graph_NS'
+
return f_ret
+
except Exception as e:
log.exception('decorator__ws_multicast: failed to differentiate REST vs Websocket call path based on stack state', e)