Browse Source

/node/<id>.json: (bugfix) send 404 on non-existing node

Logic was flawed: the check if the node is None was done after setting
its status field, thereby making the 404 check superfluos. The result
were query results of the form '{status:"unknown"}'.
Helge Jung 9 years ago
parent
commit
d33e19967f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      ffstatus/server.py

+ 3 - 3
ffstatus/server.py

@@ -324,14 +324,14 @@ angesprochen und sollte aus einer Mehrzahl von Gr&uuml;nden nicht
         # search node by the given id
         node = self.server.storage.find_node(rawid)
 
-        # add node's status
-        node['status'] = self.server.storage.get_nodestatus(node=node)
-
         # handle unknown nodes
         if node is None:
             self.send_error(404, 'No node with id \'' + rawid + '\' present.')
             return
 
+        # add node's status
+        node['status'] = self.server.storage.get_nodestatus(node=node)
+
         # dump node data as JSON
         self.__send_headers('application/json',
                             extra={'Content-Disposition': 'inline'})