[Zope-Checkins] CVS: Releases/Zope/lib/python/Products/PageTemplates/help - tal-repeat.stx:1.6
Thu, 13 Dec 2001 15:18:52 -0500
Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates/help
In directory cvs.zope.org:/tmp/cvs-serv18549/help
Fix first() and last() to work with Zope security, document them.
=== Releases/Zope/lib/python/Products/PageTemplates/help/tal-repeat.stx 1.5 => 1.6 ===
o *end* - true for the ending, or final, repetition.
+ o *first* - true for the first item in a group - see note below
+ o *last* - true for the last item in a group - see note below
o *length* - length of the sequence, which will be the total number
@@ -65,6 +69,15 @@
attribute access to get the information, for example,
+ Note that 'first' and 'last' are intended for use with sorted
+ sequences. They try to divide the sequence into group of items
+ with the same value. If you provide a path, then the value
+ obtained by following that path from a sequence item is used for
+ grouping, otherwise the value of the item is used. You can
+ provide the path by passing it as a parameter, as in
+ "python:repeat['item'].first('color')", or by appending it to the
+ path from the repeat variable, as in "repeat/item/first/color".
Iterating over a sequence of strings::
@@ -94,5 +107,14 @@
tal:replace="string:$x * $y = $z">1 * 1 = 1</span>
+ Objects (already sorted by meta-type) in groups by meta-type::
+ <table border="1">
+ <tr tal:repeat="object objects">
+ <td><span tal:condition="repeat/object/first/meta_type"
+ tal:replace="object/meta_type">Meta Type</span></td>