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.
On Tue, Jul 30, 2002 at 11:52:46AM -0700, 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.
You can use same_type(x,y) without any special imports in python scripts. example: if same_type(x,[]): #do something else: print 'x is not a list' HTH, Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris Meyers Huttleston Data Design 7941 Tree Lane Suite 200 Madison WI 53717
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
participants (3)
-
Chris Meyers -
Dennis Allison -
Evan Simpson