Browse Source

allow querying __RAW__ node detail, again

Helge Jung 9 years ago
parent
commit
eff4f9e01e
2 changed files with 9 additions and 6 deletions
  1. 8 5
      ffstatus/basestorage.py
  2. 1 1
      ffstatus/server.py

+ 8 - 5
ffstatus/basestorage.py

@@ -167,7 +167,7 @@ class BaseStorage(object):
 
         return result
 
-    def find_node(self, rawid):
+    def find_node(self, rawid, include_raw_data=False):
         """
         Fetch node data by given id.
         If necessary, look through node aliases.
@@ -175,10 +175,13 @@ class BaseStorage(object):
 
         # look through all nodes
         found = None
-        for node in self.get_nodes():
+        nodes = self.get_all_nodes_raw()
+        for nodeid in nodes:
+            node = nodes[nodeid]
+
             # if we have a direct hit, return it immediately
-            if node['node_id'] == rawid:
-                return sanitize_node(node)
+            if nodeid == rawid:
+                return sanitize_node(node, include_raw_data=include_raw_data)
 
             # search through aliases
             if 'aliases' in node and rawid in node['aliases']:
@@ -186,7 +189,7 @@ class BaseStorage(object):
 
         # return found node
         if not found is None:
-            return sanitize_node(found)
+            return sanitize_node(found, include_raw_data=include_raw_data)
         else:
             return None
 

+ 1 - 1
ffstatus/server.py

@@ -341,7 +341,7 @@ angesprochen und sollte aus einer Mehrzahl von Gründen nicht
         all other as JSON.
         """
 
-        node = self.server.storage.find_node(nodeid)
+        node = self.server.storage.find_node(nodeid, include_raw_data=True)
         if node is None:
             self.send_error(404, 'No node with id \'' + nodeid + '\' present.')
             return