[Zope-Checkins] SVN: Zope/trunk/ - Collector #1477:
TaintedString.strip() now implements the
Andreas Jung
andreas at andreas-jung.com
Fri Sep 10 13:01:59 EDT 2004
Log message for revision 27494:
- Collector #1477: TaintedString.strip() now implements the
same signature as str.strip()
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/ZPublisher/TaintedString.py
U Zope/trunk/lib/python/ZPublisher/tests/testTaintedString.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2004-09-10 16:04:51 UTC (rev 27493)
+++ Zope/trunk/doc/CHANGES.txt 2004-09-10 17:01:58 UTC (rev 27494)
@@ -157,6 +157,9 @@
Bugs fixed
+ - Collector #1477: TaintedString.strip() now implements the
+ same signature as str.strip()
+
- TAL: tal:on-error does not trap ConflictError anymore.
- OFS.CopySupport: Enforced "Delete objects" permission during
Modified: Zope/trunk/lib/python/ZPublisher/TaintedString.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/TaintedString.py 2004-09-10 16:04:51 UTC (rev 27493)
+++ Zope/trunk/lib/python/ZPublisher/TaintedString.py 2004-09-10 17:01:58 UTC (rev 27494)
@@ -131,13 +131,21 @@
def createOneArgWrapper(func):
return lambda s, a, f=func: s.__class__(getattr(s._value, f)(a))
+def createOneOptArgWrapper(func):
+ return lambda s, a=None, f=func: s.__class__(getattr(s._value, f)(a))
+
simpleWrappedMethods = \
- "capitalize lower lstrip rstrip strip swapcase title upper".split()
+ "capitalize lower swapcase title upper".split()
oneArgWrappedMethods = "center join ljust rjust".split()
+oneOptArgWrappedMethods = "lstrip rstrip strip".split()
+
for f in simpleWrappedMethods:
setattr(TaintedString, f, createSimpleWrapper(f))
for f in oneArgWrappedMethods:
setattr(TaintedString, f, createOneArgWrapper(f))
+
+for f in oneOptArgWrappedMethods:
+ setattr(TaintedString, f, createOneOptArgWrapper(f))
Modified: Zope/trunk/lib/python/ZPublisher/tests/testTaintedString.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testTaintedString.py 2004-09-10 16:04:51 UTC (rev 27493)
+++ Zope/trunk/lib/python/ZPublisher/tests/testTaintedString.py 2004-09-10 17:01:58 UTC (rev 27494)
@@ -90,6 +90,12 @@
else:
self.failIf(isinstance(v, self._getClass()))
+ optArg = "lstrip rstrip strip".split()
+ for f in optArg:
+ v = getattr(tainted, f)(" ")
+ self.assertEquals(v, getattr(unquoted, f)(" "))
+ self.assert_(isinstance(v, self._getClass()))
+
justify = "center ljust rjust".split()
for f in justify:
v = getattr(tainted, f)(30)
More information about the Zope-Checkins
mailing list