Fix exception handling and remove debug output

This commit is contained in:
Daniel Ehlers 2013-12-29 20:20:33 +01:00
parent a0c234ea05
commit 53d8f4bcf2

View file

@ -34,14 +34,14 @@ class NodeDB:
if mac.lower() in node.macs: if mac.lower() in node.macs:
return node return node
raise raise KeyError
def maybe_node_by_id(self, mac): def maybe_node_by_id(self, mac):
for node in self._nodes: for node in self._nodes:
if mac.lower() == node.id: if mac.lower() == node.id:
return node return node
raise raise KeyError
def parse_vis_data(self,vis_data): def parse_vis_data(self,vis_data):
for x in vis_data: for x in vis_data:
@ -221,7 +221,6 @@ class NodeDB:
if node.flags['client']: if node.flags['client']:
node.macs = set() node.macs = set()
clientIds[node.id] = None clientIds[node.id] = None
sys.stderr.write("client:" + node.id)
for link in self._links: for link in self._links:
ids = link.source.interface ids = link.source.interface
@ -241,7 +240,6 @@ class NodeDB:
globalIdCounter += 1 globalIdCounter += 1
elif ids in clientIds: elif ids in clientIds:
sys.stderr.write("passed ids")
newId = generateId(idt) newId = generateId(idt)
clientIds[ids] = newId clientIds[ids] = newId
ids = newId ids = newId
@ -250,7 +248,6 @@ class NodeDB:
node_source.id = ids; node_source.id = ids;
elif idt in clientIds: elif idt in clientIds:
sys.stderr.write("passed idt")
newId = generateId(ids,nodeCounters) newId = generateId(ids,nodeCounters)
clientIds[idt] = newId clientIds[idt] = newId
idt = newId idt = newId
@ -261,7 +258,7 @@ class NodeDB:
link.id = ids + "-" + idt link.id = ids + "-" + idt
except: except:
raise pass
# extends node id by incremented node counter # extends node id by incremented node counter
def generateId(nodeId,nodeCounters): def generateId(nodeId,nodeCounters):