Commit 88e39252 authored by Leo Le Bouter's avatar Leo Le Bouter Committed by Leo Le Bouter

erp5_computer_metadata: update view script

Print a tree of file names instead of a pretty-printed JSON object.
It is better because the full JSON object can overload the browser.
parent 050ef155
import json
return json.dumps(json.loads(context.getData()), sort_keys=True, indent=4)
def traverse(d, depth):
res = ""
def traverse(name, cur_dict, depth):
raise NotImplementedError(cur_dict)
for key, value in cur_dict['childs']:
for name, value in d.iteritems():
for i in range(depth):
print " ",
print name
traverse(key, value['childs'], depth+1)
res += "\t"
res += name + "\n"
if len(value['childs']) > 0:
res += traverse(value['childs'], depth+1)
traverse("", json.loads(context.getData())['fs_tree'], 0)
return res
return printed
return traverse(json.loads(context.getData())['fs_tree']['childs'], 0)
......@@ -56,15 +56,6 @@
<key> <string>id</string> </key>
<value> <string>ComputerMetadataSnapshot_preview</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple>
<string>Prints, but never reads \'printed\' variable.</string>
<string>Doesn\'t print, but reads \'printed\' variable.</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment