[Zope] chr(eval(self.myhex)) works in Python console, not in python product?

Jeff Kowalczyk jtk@yahoo.com
Wed, 18 Dec 2002 15:14:39 -0500


If the following works:
>>> class Foo:
...  def __init__(self):
...   self.myhex = '0x2a'
...  def bar(self):
...   print chr(eval(self.myhex))
...
>>> foo = Foo()
>>> foo.bar()
*
in Zope's python console (2.1.3),

But in a Zope Python product method the same sort of thing fails:

Error Type: SyntaxError
Error Value: unexpected EOF while parsing (line 0)

(specifically, its a Formulator Form method, and the self.myhex is a stringfield property
of the Form instance)

is it because eval is restricted even in a python product? Restricting eval() would seem
to be an necessary security step, just wanted to check to make sure that's what causes the
syntax error.

Thanks