Enumerate may be your friend here:

<?python pages = ['one','two','three','two'] ?>
<div py:strip="True" py:for="i,pagename in enumerate(pages)">
    <a href="${std.url('/%s' % pagename)}" py:content="pagename">Content</a>
    <span class="separator" py:if="len(pages) > i">|</span>
</div>


Now, I can't quite remember, but I think that > will work there and
it's < that doesn't work.  Due to the nature of that loop you could
proably do py:if="not len(pages) == i" instead and it would have the
same effect.

This was all written in gmail, so it may or may not work out of the box :)

Lee


On 1/4/06, Ivo Looser <[EMAIL PROTECTED]> wrote:
>
> > >
> > > Well if you know it's a list or tuple:
> > >
> > > <?python pages = ['one','two','three'] ?>
> > > <div py:strip="True" py:for="pagename in pages">
> > > <a href="${std.url('/%s' % pagename)}"
> > py:content="pagename">Content</a>ยท
> > > <span class="separator" py:if="pagename != pages[-1]">|</span>
> > > </div>
> > >
> > > If it's an iterator, I'm not sure.
> > >
>
> Thanks Liza it works.
>
> >
> > This may not be the best general example. What if pages equaled ['one',
> > 'two', 'three', 'two']?
> >
> > -- David
> >
>
> its a unique key in the Database. Duplicates arent possible.
>
> May i come to this when i got the solution how i can change unicodes
> right to 8859-1 in Database and in the Page. :-)
>
> Best Regards Ivo
>

Reply via email to