make attribute db private
This commit is contained in:
parent
dcfcc9ff36
commit
5a2d480360
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue