[ZCM] [ZC] 1477/ 1 Request "TaintedString.strip should expect an
optional argument"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Sat Aug 21 15:35:39 EDT 2004
Issue #1477 Update (Request) "TaintedString.strip should expect an optional argument"
Status Pending, ZServer/bug+solution medium
To followup, visit:
http://zope.org/Collectors/Zope/1477
==============================================================
= Request - Entry #1 by camil7 on Aug 21, 2004 3:35 pm
The class TaintedString in the ZPublisher/TantedString.py
tries to look as close as possible as an ordinary string;
for thus it implements several methods which strings implement.
Compared to python 2.1.3, in python 2.3.2 (at least), the signature
of several methods have changed in as much as they now accept
optional arguments.
This at least affects "strip", "lstrip" and "rstrip"
If these methods are e.g. indirectly called by the "string" module
via "string.strip(value)" and "value" is a TaintedString,
this causes an error like (last line of stack trace):
File "SOFTWARE_HOME/lib/python/ZPublisher/TaintedString.py", line 129, in <lambda>
return lambda s, f=func: s.__class__(getattr(s._value, f)())
TypeError: getattr(): attribute name must be string
A simple way to reproduce the issue TTW can be made with the help of the
Formulator Product, which exactly takes the above approach by calling string.strip(value).
If Formulator is installed, try the following steps:
- create a new Formulator form
- add a StringField
- click on the "test" tab
- insert a "<" into the form field and press the "Test" button
I will try to upload a patch that fixes the issue with the split method soon.
(Currently I am still struggeling with the tests, sorry.)
==============================================================
More information about the Zope-Collector-Monitor
mailing list