Dieter Thank you. I think I was 90% there but that's failure! Can you tell me if my failure to access PythonScript due to file permissions, role security attributes, or Zope paranoia (need to use external method??)? It certainly does not fail cleanly and I have raised the bug. Charles ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Charles Zealey" <charles@itsolve.co.uk> Cc: <zope@zope.org> Sent: Thursday, May 15, 2003 8:09 PM Subject: Re: [Zope] manage_addPythonScript
Charles Zealey wrote at 2003-5-15 14:39 +0100:
I'm haing some problems calling manage_addPythonScript. While the manual mentions it's existence I can find no examples of how to call it (a common complaint!).
However, when I get something that runs I get
Error Type: TypeError Error Value: 'in' or 'not in' needs sequence right argument
(which I have only ever seen where python versions are wrong.....)
Is this a permisssions problem, a bug, or simply user error?
I'd appreciate your wisdom.......
The primary wisdom is to look at the traceback :-)
It tells you that the problem is in line 2 of your Python Script "test".
... # Example code: from Products.PythonScripts.PythonScript import PythonScript ... File Script (Python), line 2, in test File /home/usr/local/src/Zope/lib/python/AccessControl/ZopeGuards.py, line 144, in guarded_import File /home/usr/local/src/Zope/lib/python/AccessControl/SecurityManager.py, line 83, in validate File
/home/usr/local/src/Zope/lib/python/AccessControl/ZopeSecurityPolicy.py, line
157, in validate TypeError: (see above)
I expect that your are not allowed to import the module "PythonScript".
I agree however that this error message gives you little chance to see this.
Please file a bug report to <http://collector.zope.org/Zope>.
The standard method to create a PythonScript (in an ObjectManager "om") is:
om.manage_addProduct['PythonScripts'].manage_addPythonScript(id) myPythonScript= getattr(om,id)
You can later use the PythonScript method "ZPythonScript_edit" to set parameters and body of the script.
Dieter