[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/tests/test_edgecases.py Failing test case using tal:repeat and interpolation.

Chris McDonough chrism at plope.com
Mon Sep 1 16:20:05 EDT 2008


Log message for revision 90667:
  Failing test case using tal:repeat and interpolation.
  

Changed:
  U   z3c.pt/trunk/src/z3c/pt/tests/test_edgecases.py

-=-
Modified: z3c.pt/trunk/src/z3c/pt/tests/test_edgecases.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/tests/test_edgecases.py	2008-09-01 20:06:55 UTC (rev 90666)
+++ z3c.pt/trunk/src/z3c/pt/tests/test_edgecases.py	2008-09-01 20:20:05 UTC (rev 90667)
@@ -178,6 +178,42 @@
         t.doctype = doctypes.html
         self.assertEqual(norm(t.render()), norm(expected))
 
+class TestBadAttributeInterpolationWithTAL(unittest.TestCase, PlacelessSetup):
+    def test_snippet(self):
+        body = """\
+        <div xmlns:tal="http://xml.zope.org/namespaces/tal"
+             xmlns="http://www.w3.org/1999/xhtml">
+        <span tal:repeat="ltr letters">
+	<a class="${ltr.iscurrent}" href="${ltr.href}">${ltr.letter}</a>
+        </span>
+        </div>
+        """
+        import z3c.pt
+        from zope.configuration import xmlconfig
+        xmlconfig.file('configure.zcml', z3c.pt)
+        from z3c.pt.pagetemplate import PageTemplate
+        letters = [
+            {'letter':'A', 'href':'?titlestartswith=A',
+             'iscurrent':'current'},
+            {'letter':'B', 'href':'?titlestartswith=B',
+             'iscurrent':'notcurrent'},
+            ]
+        t = PageTemplate(body)
+        expected = """\
+        <div>
+        <span>
+	<a class="notcurrent" href="?titlestartswith=A">A</a>
+        </span>
+        <span>
+	<a class="notcurrent" href="?titlestartswith=B">B</a>
+        </span>
+        </div>"""
+
+        output = t.render(letters=letters)
+        
+        self.assertEqual(norm(output), norm(expected))
+        
+
 def norm(s):
     return s.replace(' ', '').replace('\n', '')
 



More information about the Checkins mailing list