Can someone tell me why i cant import types into my python script in CMF? When i put either of the following lines as the first line of my script i get the error that follows from types import * - produces Error Type: ImportError Error Value: "from types import *" is not allowed from types import ListType - produces Error Type: ImportError Error Value: import of "ListType" from "types" is unauthorized. You are not allowed to access ListType in this context
For security reasons many of the standard libraries are not allowd to be used in Zope. Types is one of them. You can declare a library as save for use in a python script. How I can not say without consulting the documentation. Robert Am Friday 15 August 2003 04:18 schrieb Declan Shanaghy:
Can someone tell me why i cant import types into my python script in CMF? When i put either of the following lines as the first line of my script i get the error that follows
from types import * - produces Error Type: ImportError Error Value: "from types import *" is not allowed
from types import ListType - produces Error Type: ImportError Error Value: import of "ListType" from "types" is unauthorized. You are not allowed to access ListType in this context
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
-- mit freundlichen GrĂ¼ssen Robert Rottermann www.redCOR.ch
Look in lib/python/Products/PythonScripts/module_access_examples.py for how to define modules as safe. -Chris Fri, 15 Aug 2003 06:49:51 +0200, robert spoke forth:
For security reasons many of the standard libraries are not allowd to be used in Zope. Types is one of them. You can declare a library as save for use in a python script. How I can not say without consulting the documentation. Robert Am Friday 15 August 2003 04:18 schrieb Declan Shanaghy:
Can someone tell me why i cant import types into my python script in CMF? When i put either of the following lines as the first line of my script i get the error that follows
from types import * - produces Error Type: ImportError Error Value: "from types import *" is not allowed
from types import ListType - produces Error Type: ImportError Error Value: import of "ListType" from "types" is unauthorized. You are not allowed to access ListType in this context
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Add a folder called GlobalModules in your Products directory and put in that folder a file called '__init__.py' with this content: ---- from Products.PythonScripts.Utility import allow_module allow_module('types') ---- with this you can't use "from types import *" but you can use the second form "from types import ListType, StringType, ..." Il ven, 2003-08-15 alle 04:18, Declan Shanaghy ha scritto:
Can someone tell me why i cant import types into my python script in CMF? When i put either of the following lines as the first line of my script i get the error that follows
from types import * - produces Error Type: ImportError Error Value: "from types import *" is not allowed
from types import ListType - produces Error Type: ImportError Error Value: import of "ListType" from "types" is unauthorized. You are not allowed to access ListType in this context
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) -- paolo <paolomail@noze.it> Noze srl
participants (4)
-
Christopher N. Deckard -
Declan Shanaghy -
paolo -
robert