From f7417f0939d6d2b423e81dfb4cfa300e83c458a7 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 4 Jun 2012 18:55:20 +0200 Subject: [PATCH] bugfix --- nodedb.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nodedb.py b/nodedb.py index 64e1fa1..f9adba7 100644 --- a/nodedb.py +++ b/nodedb.py @@ -190,9 +190,13 @@ class NodeDB: macs = [s for s in [s.strip() for s in node['MAC'].split(',')] if s] gps = [s for s in [s.strip() for s in node['GPS'].split(',')] if s] - names = [s for s in [s.strip() for s in node['Nick'].split(',')] if s] + if 'MAC' in node: + names = [s for s in [s.strip() for s in node['Nick'].split(',')] if s] + zipped = zip(macs, gps, names) + else: + zipped = zip(macs, gps) - for pair in zip(macs, gps, names): + for pair in zipped: try: node = self.maybe_node_by_mac((pair[0], )) except: @@ -200,8 +204,9 @@ class NodeDB: node.add_mac(pair[0]) self._nodes.append(node) - if pair[2]: - node.name = pair[2] + if '2' in pair: + if pair[2]: + node.name = pair[2] node.gps = pair[1]