make attribute db private

alfred-data
Nils Schneider 2012-05-12 14:57:25 +02:00
parent dcfcc9ff36
commit 5a2d480360
1 changed files with 3 additions and 5 deletions

View File

@ -1,21 +1,19 @@
import json
class D3MapBuilder:
db = None
def __init__(self, db):
self.db = db
self._db = db
def build(self):
output = dict()
output['nodes'] = [{'group': x.group, 'name': x.name,
'macs': ', '.join(x.macs)
} for x in self.db.get_nodes() if x.online]
} for x in self._db.get_nodes() if x.online]
output['links'] = [{'source': x.pair[0], 'target': x.pair[1],
'distance': x.distance,
'strength': x.strength
} for x in self.db.get_links()]
} for x in self._db.get_links()]
return json.dumps(output)