I have a variable, f.

The value of f might be a list, or it might be a string.

I want to do different things to f depending what type it is.

How do I check its type from a PythonScript?

I can't use type(), as this opens up a security hole with Extension 
Classes, where the type is the class.

I can't import types, as that seems to be restricted.

I suggest that either one or both of the following be altered:

  * The types module is allowed to be imported into restricted stuff.

  * A safe version of type() is put into the restricted global namespace.

I seem to recall a discussion of this a few months ago, where someone 
(Evan?) proposed a safe version of type(). I guess this got lost in the 
conversion to RestrictedPython with Zope 2.4.

Oh yeah... an ugly workaround is to try to append to f and see if you 
get and AttributeError.

Steve Alexander
Software Engineer
Cat-Box limited

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to