hi, I'm using Zope (2.6.0, Pyth 2.1.3, Solaris 2.7) as an XML-RPC server, and need to use the XML-RPC boolean datatype. I have a test python script, which accepts a single-struct (dictionary) parameter, checks a boolean value passed to it and responds with another boolean value, but I'm having problems with importing permissions. my script, booltest: ##parameters:=param from xmlrpclib import True, False if param['dead'] == True: alive = False else: alive = True return {'name': param['name'], 'alive': alive} when I call the method from a standalone python script, testbool.py: #!/usr/local/bin/python s=xmlrpclib.Server("http://www.myzopeserver.com") p1 = {'name': 'ben', 'dead': xmlrpclib.False} res = s.test.testbool(p1) print str(res) I get a Zope error (bottom of stacktrace returned): ImportError: import of "True" from "xmlrpclib" is unauthorized. You are not allowed to access True in this context for the security settings of the folder that booltest lives, I have set the user to have permissions on: access contents information import/export objects query view is this a problem with security settings on the object or container, or something else? can anyone help? TIA Ben Avery YouthNet UK
hi,
I'm using Zope (2.6.0, Pyth 2.1.3, Solaris 2.7) as an XML-RPC server, and need to use the XML-RPC boolean datatype.
I have a test python script, which accepts a single-struct (dictionary) parameter, checks a boolean value passed to it and responds with another boolean value, but I'm having problems with importing permissions.
my script, booltest:
##parameters:=param from xmlrpclib import True, False
if param['dead'] == True: alive = False else: alive = True
return {'name': param['name'], 'alive': alive}
Did you test this without xml-rpc (using the "Test" tab of ZMI ?). You should start with this. Seems that importing xmlrpclib is not allowed in a TTW script (only "string", "math", "random" + some others - see the doc). Replace the "import..." line by True = 1 Fales = 0 This should do the job. HTH --Gilles
Ben Avery writes:
I'm using Zope (2.6.0, Pyth 2.1.3, Solaris 2.7) as an XML-RPC server, and need to use the XML-RPC boolean datatype.
I have a test python script... ... from xmlrpclib import True, False ... I get a Zope error (bottom of stacktrace returned): ImportError: import of "True" from "xmlrpclib" is unauthorized. You are not allowed to access True in this context You must allow the import of modules and name for Python Scripts. Read the "README" tab in "Control_Panel --> Product Management --> PythonScripts to learn how to do this.
Dieter
participants (3)
-
Ben Avery -
Dieter Maurer -
Gilles Lenfant