[Checkins] SVN: zope.tales/branches/3.5/ Subexpressions of a 'string:' expression can be only path expressions.
Tres Seaver
cvs-admin at zope.org
Wed May 23 15:31:46 UTC 2012
Log message for revision 126473:
Subexpressions of a 'string:' expression can be only path expressions.
See: https://bugs.launchpad.net/zope.tales/+bug/1002242
Changed:
U zope.tales/branches/3.5/CHANGES.txt
U zope.tales/branches/3.5/src/zope/tales/expressions.py
U zope.tales/branches/3.5/src/zope/tales/tests/test_expressions.py
-=-
Modified: zope.tales/branches/3.5/CHANGES.txt
===================================================================
--- zope.tales/branches/3.5/CHANGES.txt 2012-05-23 15:26:29 UTC (rev 126472)
+++ zope.tales/branches/3.5/CHANGES.txt 2012-05-23 15:31:42 UTC (rev 126473)
@@ -4,7 +4,8 @@
3.5.2 (unreleased)
------------------
-- TBD
+- Subexpressions of a 'string:' expression can be only path expressions.
+ https://bugs.launchpad.net/zope.tales/+bug/1002242
3.5.1 (2010-04-30)
------------------
Modified: zope.tales/branches/3.5/src/zope/tales/expressions.py
===================================================================
--- zope.tales/branches/3.5/src/zope/tales/expressions.py 2012-05-23 15:26:29 UTC (rev 126472)
+++ zope.tales/branches/3.5/src/zope/tales/expressions.py 2012-05-23 15:31:42 UTC (rev 126473)
@@ -224,7 +224,9 @@
-_interp = re.compile(r'\$(%(n)s)|\${(%(n)s(?:/[^}]*)*)}' % {'n': NAME_RE})
+_interp = re.compile(
+ r'\$(%(n)s)|\${(%(n)s(?:/[^}|]*)*(?:\|%(n)s(?:/[^}|]*)*)*)}'
+ % {'n': NAME_RE})
class StringExpr(object):
implements(ITALESExpression)
Modified: zope.tales/branches/3.5/src/zope/tales/tests/test_expressions.py
===================================================================
--- zope.tales/branches/3.5/src/zope/tales/tests/test_expressions.py 2012-05-23 15:26:29 UTC (rev 126472)
+++ zope.tales/branches/3.5/src/zope/tales/tests/test_expressions.py 2012-05-23 15:31:42 UTC (rev 126473)
@@ -136,11 +136,24 @@
context=self.context
self.assertEqual(expr(context), 'A2')
+ def testStringSub_w_python(self):
+ CompilerError = self.engine.getCompilerError()
+ self.assertRaises(CompilerError,
+ self.engine.compile,
+ 'string:${python:1}')
+
def testStringSubComplex(self):
expr = self.engine.compile('string:a ${x/y} b ${y/z} c')
context=self.context
self.assertEqual(expr(context), 'a yikes b 3 c')
-
+
+ def testStringSubComplex_w_miss_and_python(self):
+ # See https://bugs.launchpad.net/zope.tales/+bug/1002242
+ CompilerError = self.engine.getCompilerError()
+ self.assertRaises(CompilerError,
+ self.engine.compile,
+ 'string:${nothig/nothing|python:1}')
+
def testString8Bits(self):
# Simple eight bit string interpolation should just work.
expr = self.engine.compile('string:a ${eightBits}')
More information about the checkins
mailing list