New submission from do3cc <do3cc...@googlemail.com>:

This issue was found while using chameleon with plone.
There, folders have a folder_tabular_view, that uses a macro, and contains
fill-slot snippets that try to access the repeat variable from the macro.
That fails, debugging showed, that the repeat var is totally empty.
Assuming that code is specification and that this does not fail with zope stock
zpt implementation, I believe this to be a bug.
I attached a diff agains Chameleon that modifies an existing doctest, to trigger
the problematic behaviour.

----------
files: bug.diff
messages: 411
nosy: do3cc
priority: bug
status: unread
title: Chamelopn does not pass on repeat variables to fill-slot snippets

__________________________________
Repoze Bugs <b...@bugs.repoze.org>
<http://bugs.repoze.org/issue148>
__________________________________
Index: src/chameleon/zpt/template.txt
===================================================================
--- src/chameleon/zpt/template.txt	(revision 9470)
+++ src/chameleon/zpt/template.txt	(working copy)
@@ -66,16 +66,18 @@
   ...       metal:define-macro="master"
   ...       template-macros="${' '.join(template.macros.names)}"
   ...       macros="${' '.join(macros.names)}">
-  ...     <metal:block tal:define="foo 'foo'">
-  ...       Who are you, ${foo}?
-  ...       <div metal:define-slot="content" tal:replace="None">
-  ...          I will be replaced
-  ...       </div>
-  ...       <span template-macros="${' '.join(template.macros.names)}"
+  ...     <metal:block tal:define="foo 'foobar'">
+  ...      <metal:block tal:repeat="item python:[1]">
+  ...       Who are you, ${foo}? Even: ${repeat.item.even}
+  ...         <div metal:define-slot="content" tal:replace="None">
+  ...            I will be replaced.
+  ...         </div>
+  ...        <span template-macros="${' '.join(template.macros.names)}"
   ...             macros="${' '.join(macros.names)}">
   ...          <!-- demonstrate difference between
   ...               `template` and `macros` symbol -->
-  ...       </span>
+  ...        </span>
+  ...      </metal:block>
   ...     </metal:block>
   ... </html>""")
 
@@ -84,7 +86,7 @@
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
   <html xmlns="http://www.w3.org/1999/xhtml";
         template-macros="master" macros="master">
-     Who are you, foo?
+     Who are you, foobar? Even: even
      <span template-macros="master" macros="master">
         <!-- demonstrate difference between
              `template` and `macros` symbol -->
@@ -113,7 +115,7 @@
   ...      metal:use-macro="main.macros['master']">
   ...     <div metal:fill-slot="content">
   ...         <tal:block tal:define="bar 'boo'" i18n:domain="bar">
-  ...           I replace you: ${dummy|foo} (${bar}).
+  ...           I replace you: ${dummy|foo} (${bar}). Even: ${repeat.item.even}
   ...         </tal:block>
   ...     </div>
   ...     <metal:block metal:define-macro="dummy" />
@@ -124,9 +126,9 @@
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
   <html xmlns="http://www.w3.org/1999/xhtml";
         template-macros="dummy" macros="master">
-    Who are you, foo?
+    Who are you, foobar? Even: even
     <div>
-       I replace you: foo (boo).
+       I replace you: foobar (boo). Even: even
     </div>
     <span template-macros="dummy" macros="master">
        <!-- demonstrate difference between
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to