Python Scripts: assignment error when namespace is bound
Greetings I just noticed that (with Zope-2.3.1b3, Python 1.5.2, under Debian 2.2) when namespace is bound (namespace=_) in Python Scripts, I can not use names accessible through the namespace as assignment targets. For instance, the top folder where I was testing had a string property named 'color_dm'. When the following simple script was called from a DTML Method color_dm = 42 return 14 I got Error Type: TypeError Error Value: no arguments expected This one: index_html = 42 return 14 resulted in Error Type: SystemError Error Value: Excessive recursion with the following repeating messages: File /usr/local/src/Zope-2.3.1b3-src/lib/python/OFS/DTMLMethod.py, line 182, in __call__ (Object: index_html) File /usr/local/src/Zope-2.3.1b3-src/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: index_html) File /usr/local/src/Zope-2.3.1b3-src/lib/python/Shared/DC/Scripts/Bindings.py, line 334, in __render_with_namespace__ (Object: serpent) There are no problems if namespace is not bound or the script is invoked directly in a URL (because of the resulting empty namespace, I believe). -- jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/
From: "J M Cerqueira Esteves" <jmce@artenumerica.com>
I just noticed that (with Zope-2.3.1b3, Python 1.5.2, under Debian 2.2) when namespace is bound (namespace=_) in Python Scripts, I can not use names accessible through the namespace as assignment targets. For instance, the top folder where I was testing had a string property named 'color_dm'. When the following simple script was called from a DTML Method
color_dm = 42 return 14
I got
Error Type: TypeError Error Value: no arguments expected
I can't replicate this behavior with the CVS version. Could you send me an example of this problem in an export (.zexp) file? Cheers, Evan @ digicool
This one:
index_html = 42 return 14
resulted in
Error Type: SystemError Error Value: Excessive recursion
with the following repeating messages:
Yeah, I've had this one too :-( Dunno what's causing it but it also happens if you have the names specified as parameters to the python script. I think it's something to do with PS's calling the name if they can before returning it. This is probably to make it behave like DTML but is a bad thing in my experience, especially if calling the thing ends up recursively calling the python script, which might be what's happening here. Or I could be talking rubbish ;-) cheers, Chris
participants (3)
-
Chris Withers -
Evan Simpson -
J M Cerqueira Esteves