Author: reebalazs
Date: Thu Sep 27 19:41:28 2007
New Revision: 46971

Modified:
   kukit/kss.demo/branch/ree-demoload/kss/demo/browser/kss_demo_index.pt
   kukit/kss.demo/branch/ree-demoload/kss/demo/browser/registry.py
Log:
Make index template z3 compatible with respect to lack of 
repeat(...).first(...) support

Modified: kukit/kss.demo/branch/ree-demoload/kss/demo/browser/kss_demo_index.pt
==============================================================================
--- kukit/kss.demo/branch/ree-demoload/kss/demo/browser/kss_demo_index.pt       
(original)
+++ kukit/kss.demo/branch/ree-demoload/kss/demo/browser/kss_demo_index.pt       
Thu Sep 27 19:41:28 2007
@@ -10,13 +10,13 @@
      <li><a href="@@kukittestsuite">Run all tests</a></li>
     </ul>
       <tal:groups repeat="demo_group 
context/@@kss_demo_registry/getDemoGroups">
-        <tal:plugin 
condition="python:repeat['demo_group'].first('plugin_namespace') and 
demo_group['plugin_namespace']==''">
+        <tal:plugin condition="python:demo_group['is_first_plugin_namespace'] 
and demo_group['plugin_namespace']==''">
              <h2>Core plugin</h2>
         </tal:plugin>
-        <tal:plugin 
condition="python:repeat['demo_group'].first('plugin_namespace') and 
demo_group['plugin_namespace']">
+        <tal:plugin condition="python:demo_group['is_first_plugin_namespace'] 
and demo_group['plugin_namespace']">
              <h2>Plugin namespace: <b 
tal:content="demo_group/plugin_namespace">core</b></h2>
         </tal:plugin>
-        <tal:category condition="python:repeat['demo_group'].first('category') 
and demo_group['category']">
+        <tal:category condition="python:demo_group['is_first_category'] and 
demo_group['category']">
           <h3 tal:content="demo_group/category">Category</h3>
         </tal:category>
         <ul>

Modified: kukit/kss.demo/branch/ree-demoload/kss/demo/browser/registry.py
==============================================================================
--- kukit/kss.demo/branch/ree-demoload/kss/demo/browser/registry.py     
(original)
+++ kukit/kss.demo/branch/ree-demoload/kss/demo/browser/registry.py     Thu Sep 
27 19:41:28 2007
@@ -21,17 +21,32 @@
         for demo in self.getSortedDemos():
             plugin_namespace = demo['plugin_namespace']
             category =  demo['category']
-            if prev_plugin_namespace != plugin_namespace or \
-                    prev_category != category:
+            # Set a flag on first rows in group, 
+            # since z3 seems not to  handle rpeeat(..).first()
+            # These will be used for grouping
+            if prev_plugin_namespace != plugin_namespace:
+                is_first_plugin_namespace = True
+                prev_plugin_namespace = plugin_namespace
+            else:
+                is_first_plugin_namespace = False
+            if prev_category != category:
+                is_first_category = True
+                prev_category = category
+            else:
+                is_first_category = False
+            # If plugin_namespace or category changed, time to
+            # start a new group.
+            if is_first_plugin_namespace or is_first_category:
                 # Start a new group.
                 group = []
                 demo_groups.append(dict(
                     plugin_namespace = plugin_namespace,
                     category = category,
                     demos = group,
+                    is_first_plugin_namespace = is_first_plugin_namespace,
+                    is_first_category = is_first_category,
                     ))
-                prev_plugin_namespace = plugin_namespace
-                prev_category = category
+            # In any case append our demo to the group
             group.append(demo)
         return demo_groups
 
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to