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 import json
return json.dumps(json.loads(context.getData()), sort_keys=True, indent=4) def traverse(d, depth):
res = ""
for name, value in d.iteritems():
def traverse(name, cur_dict, depth):
raise NotImplementedError(cur_dict)
for key, value in cur_dict['childs']:
for i in range(depth): for i in range(depth):
print " ", res += "\t"
print name res += name + "\n"
traverse(key, value['childs'], depth+1) 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 @@ ...@@ -56,15 +56,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerMetadataSnapshot_preview</string> </value> <value> <string>ComputerMetadataSnapshot_preview</string> </value>
</item> </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> </dictionary>
</pickle> </pickle>
</record> </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