[Zope] why cant i import types ?

Dylan Reinhardt zope at dylanreinhardt.com
Fri Aug 15 04:52:18 EDT 2003


On Thu, 2003-08-14 at 19:34, Declan Shanaghy wrote:
> Can someone tell me why i cant import types into my python
> script in CMF?

You can only import modules that are explicitly permitted.  See the
README file in the PythonScripts product directory for info.

But there's rarely any value to importing the types module anyway.  If
you want to know if something is a list, you can usually just test to
see if it has the characteristics of a list, eg:

if hasattr(my_obj, 'sort'):

Or you really must know, you can check this way:

if type(my_obj) == type([]):

HTH,

Dylan





More information about the Zope mailing list