[Zope] type() and types

Evan Simpson evan@4-am.com
Tue, 30 Jul 2002 15:12:31 -0500


Dennis Allison wrote:
> The type() function is exceptionally usful for debugging but is unavailabe
> in python scripts for security reasons.  In my debug framework I would like
> to re-enable it.  Since it's a built-in just configuring to allo the import
> of types isn't enough.  What's the hack.

See lib/python/AccessControl/ZopeGuards.py -- you should be able to add 
a line like this:

safe_builtins['type'] = type

Much safer, however, would be to create the trivial External Method:

def my_type(ob):
     return type(ob)

Cheers,

Evan @ 4-am