[Zope] Python Scripts

Tom Deprez Tom Deprez" <tom.deprez@uz.kuleuven.ac.be
Mon, 28 May 2001 11:38:56 +0200


Hi,

How can we in the python script check if the a certain variable exists in
the namespace?

ie. We can get the value of a variable by using context.myvar or
context['myvar'], but both will return an error when the myvar doesn't
exists. Now, how can you check if it exists?

I tried several things, like context.hasattr('myvar') or
context.has_key('myvar') , _hasattr(), _.hasattr() ... etc, but none seem to
work. Can somebody tell me if it even is possible? Thanks.

Tom.