sort children

This commit is contained in:
j 2018-08-10 12:18:49 +01:00
parent 2480ea6b05
commit 486baac69c

View file

@ -22,10 +22,12 @@ def find_path(parent, root=None, path=None):
return r
def get_node(name, children, parent=None):
children_ = [get_node(child, children[child], name) for child in children]
children_.sort(key=lambda c: c['name'])
node = {
"size": len(children) + 100,
"name": name,
"children": [get_node(child, children[child], name) for child in children]
"children": children_
}
if not node['children']:
del node['children']