tal:repeat and first and last.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Zopers I need to do something except on the first and last item of a tal:repeat. After some time of testing I've found that with the following code: <span tal:repeat="composer here/myComposers"> <span tal:replace="python:repeat['composer'].last()"/> </span> which iterates 4 times I've got: True True True 1, and with <span tal:repeat="composer here/myComposers"> <span tal:replace="python:repeat['composer'].first()"/> </span> I've got: 1 True True True. In any condition, 1 and True are the same, so, I couldn't build my condition. What am I doing wrong ? Should I get one true and three flases ? Thanks. - -- Pupeno: pupeno@pupeno.com - http://www.pupeno.com Like REAL Science Fiction ? http://sfreaders.com.ar -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFB00jNfW48a9PWGkURAk5gAJ0Wv1d90mpsJwXLCNWuUuuQnfElCwCfToh4 EF5P5Hjz9pWx/9GvIpr1nb8= =NUOh -----END PGP SIGNATURE-----
On 29.Dec 2004 - 21:16:09, Pupeno wrote:
Hello Zopers I've got: 1 True True True. In any condition, 1 and True are the same, so, I couldn't build my condition. What am I doing wrong ? Should I get one true and three flases ?
You should read the Zope-Book, especially the TAL Reference in Appendix C. The part about tal:repeat explains why the return values you get are correct and what you're doing wrong. In short: use repeat[..].(start|end) not first/last Andreas -- Everything will be just tickety-boo today.
participants (2)
-
Andreas Pakulat -
Pupeno