[ZCM] [ZC] 1203/ 1 Request "'ZTUtils.make_query()' broken for
python2.3"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Sun Jan 25 22:55:10 EST 2004
Issue #1203 Update (Request) "'ZTUtils.make_query()' broken for python2.3"
Status Pending, Zope/bug+solution critical
To followup, visit:
http://collector.zope.org/Zope/1203
==============================================================
= Request - Entry #1 by LRA on Jan 25, 2004 10:55 pm
passing a boolean value to "ZTUtils.make_query()" results in:
Error Type: ValueError
Error Value: An integer was expected in the value 'True'
The following PythonScript illustrates the problem:
request = context.REQUEST
response = request.RESPONSE
boolVar = request.get('boolVar', None)
if boolVar is None:
from ZTUtils import make_query
boolExp = 1 == 1
response.redirect(request['URL'] + "?" + make_query(boolVar=boolExp))
else:
print boolVar
return printed
This happens because Zope 2.6 doesn't implement a ":boolean" check in "ZTUtils.Zope.simple_parse()".
A workaround for this problem is casting the boolean value to an int before passing it to "make_query()". For instance, the PythonScript above is to change the "boolExp" line to:
boolExp = int(1 == 1)
This problem is already fixed in 2.7rc1 in "lib/python/ZTUtils/Zope.py" which is Python2.1 compatible, and so is appropriate for inclusion in the 2.6 branch (besides, it contains two other small fixes that would be nice in 2.6).
I understand Python2.3 compatibility is not a pressing issue for the 2.6 branch, but since the fix is already done, I choose to set the severity of this fix to critical to see if it gets in before 2.6.4 final is cut.
==============================================================
More information about the Zope-Collector-Monitor
mailing list