sort children
This commit is contained in:
parent
2480ea6b05
commit
486baac69c
1 changed files with 3 additions and 1 deletions
|
@ -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']
|
||||
|
|
Loading…
Reference in a new issue