chr(eval(self.myhex)) works in Python console, not in python product?
class Foo: ... def __init__(self): ... self.myhex = '0x2a' ... def bar(self): ... print chr(eval(self.myhex)) ... foo = Foo() foo.bar()
If the following works: * 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
Jeff Kowalczyk writes:
class Foo: ... def __init__(self): ... self.myhex = '0x2a' ... def bar(self): ... print chr(eval(self.myhex)) ... foo = Foo() foo.bar()
If the following works: * 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) A long time ago, I saw a similar problem report in "c.l.p". Guido recommended to add 1 or 2 newlines after the string.
Dieter
participants (2)
-
Dieter Maurer -
Jeff Kowalczyk