Commit 090a32d4 authored by Andreas Jung's avatar Andreas Jung

- Collector #1477: TaintedString.strip() now implements the

       same signature as str.strip()
parent 3bbe1fb0
......@@ -157,6 +157,9 @@ Zope Changes
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
......
......@@ -131,13 +131,21 @@ def createSimpleWrapper(func):
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))
......@@ -90,6 +90,12 @@ class TestTaintedString(unittest.TestCase):
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment