[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_In.py:1.58

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 24 Apr 2002 10:39:11 -0400


Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv23547

Modified Files:
	DT_In.py 
Log Message:
merged toby-dtml-in-namespace-branch for collector 358: new dtml-in parameter no_push_item

=== Zope/lib/python/DocumentTemplate/DT_In.py 1.57 => 1.58 ===
 
       Within an 'in' block, variables are substituted from the
-      elements of the iteration.  The elements may be either
-      instance or mapping objects.  In addition, the variables:
+      elements of the iteration unless the 'no_push_item' optional
+      is specified.  The elements may be either instance or mapping
+      objects.  In addition, the variables:
 
          'sequence-item' -- The element.
 
@@ -355,7 +356,7 @@
 
 class InClass:
     elses=None
-    expr=sort=batch=mapping=None
+    expr=sort=batch=mapping=no_push_item=None
     start_name_re=None
     reverse=None
     sort_expr=reverse_expr=None
@@ -364,6 +365,7 @@
         tname, args, section = blocks[0]
         args=parse_params(args, name='', start='1',end='-1',size='10',
                           orphan='0',overlap='1',mapping=1,
+                          no_push_item=1,
                           skip_unauthorized=1,
                           previous=1, next=1, expr='', sort='',
                           reverse=1, sort_expr='', reverse_expr='',
@@ -384,6 +386,9 @@
         if has_key('reverse'):
             self.reverse=args['reverse']
             
+        if has_key('no_push_item'):
+            self.no_push_item=args['no_push_item']
+            
         if has_key('mapping'): self.mapping=args['mapping']
         for n in 'start', 'size', 'end':
             if has_key(n): self.batch=1
@@ -453,6 +458,7 @@
         params=self.args
         
         mapping=self.mapping
+        no_push_item=self.no_push_item
 
         if self.sort_expr is not None:
             self.sort=self.sort_expr.eval(md)
@@ -584,7 +590,9 @@
                     if t is TupleType and len(client)==2:
                         client=client[1]
 
-                    if mapping:
+                    if no_push_item:
+                        pushed = 0
+                    elif mapping:
                         pushed = 1
                         push(client)
                     elif t in StringTypes:
@@ -630,7 +638,7 @@
 
         section=self.section        
         mapping=self.mapping
-
+        no_push_item=self.no_push_item
 
         if self.sort_expr is not None:
             self.sort=self.sort_expr.eval(md)
@@ -683,7 +691,9 @@
                     if t is TupleType and len(client)==2:
                         client=client[1]
 
-                    if mapping:
+                    if no_push_item:
+                        pushed = 0
+                    elif mapping:
                         pushed = 1
                         push(client)
                     elif t in StringTypes: