[Zope] RE: zshell question: find vs ZopeFind
Jean Jordaan
jean@upfrontsystems.co.za
Thu, 13 Jun 2002 16:06:03 +0200
Hi Jerome
I'm very happy with the following, which calls 'lsprop' on a list of
propertysheets::
commands = {}
for ps in propertysheets:
commands[ps] = 'lsprop %s'%ps
results = {}
for key in commands.keys():
xmlrpcstuff = {
'path': '/', 'result_type': 'text', 'command': commands[key]
}
out = context.zshell(xmlrpcstuff=xmlrpcstuff)
results[key] = out['data'].split('\n')[:-1]
It seems that zshell's 'text' output format is less rich than its
HTML output -- the difference between 'MyShell.get_stdout()' (returns
only property names) and 'MyShell.get_HTML()' (returns type and value
as well). I made this change (assuming that stdout can be parsed
tab-seperated-value-like), in case you want to consider it:
--- /tmp/zshell.py.orig Thu Jun 13 15:53:14 2002
+++ zshell.py Thu Jun 13 15:51:38 2002
@@ -3407,7 +3407,8 @@
propvalue = repr(object.getProperty(prop["id"], 'Error'))
results.append({"Property": propid, "Type": proptype, "Value": propvalue, "Mode": propmode})
- self.printf("%s" % propid)
+ self.printf("%s\t%s\t%s\t%s\n" % (propid, proptype, propvalue, propmode))
+
self.tableDisplay("lsprop", ["Property", "Type", "Value", "Mode"], results)
return status
--
Jean Jordaan
Upfront Systems http://www.upfrontsystems.co.za