Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

TALES iterator odd/even reversal

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


marius at gedmin

Jul 3, 2008, 4:05 PM

Post #1 of 3 (327 views)
Permalink
TALES iterator odd/even reversal

Recently I migrated a large-ish app built on Zope 3.2 to Zope 3.4.
("About time" I hear someone mumbling in the audience.) One strange
difference was that TALES iterators swapped the meaning of odd and even,
i.e.

<p tal:repeat="item python: [1, 2, 3, 4]">
<span tal:condition="repeat/var/odd">odd<span>
<span tal:condition="repeat/var/even">even<span>
</p>

produces different results on Zope 3.4 than it did on 3.2.

Does anyone know why this is? Is this a bug? Should it be fixed?

Marius Gedminas
--
Perl is hard for most people to write. They write PERL or Pearl.
-- Abigail
Attachments: signature.asc (0.19 KB)


lists at zopyx

Jul 4, 2008, 9:05 AM

Post #2 of 3 (296 views)
Permalink
Re: TALES iterator odd/even reversal [In reply to]

--On 4. Juli 2008 02:05:30 +0300 Marius Gedminas <marius[at]gedmin.as> wrote:

> Recently I migrated a large-ish app built on Zope 3.2 to Zope 3.4.
> ("About time" I hear someone mumbling in the audience.) One strange
> difference was that TALES iterators swapped the meaning of odd and even,
> i.e.
>
> <p tal:repeat="item python: [1, 2, 3, 4]">
> <span tal:condition="repeat/var/odd">odd<span>
> <span tal:condition="repeat/var/even">even<span>
> </p>
>
> produces different results on Zope 3.4 than it did on 3.2.

First, your example does not work (must be repeat/item instead of
repeat/var).
>
> Does anyone know why this is? Is this a bug? Should it be fixed?

Where exactly is the bug?

The output is even-odd-even-odd. The even/odd methods apply to the current
iteration number afaik - but not to the variable within the current
iteration itself. Or?

Andreas


marius at gedmin

Jul 4, 2008, 1:02 PM

Post #3 of 3 (293 views)
Permalink
Re: TALES iterator odd/even reversal [In reply to]

On Fri, Jul 04, 2008 at 06:05:05PM +0200, Andreas Jung wrote:
> --On 4. Juli 2008 02:05:30 +0300 Marius Gedminas <marius[at]gedmin.as> wrote:
>
> >Recently I migrated a large-ish app built on Zope 3.2 to Zope 3.4.
> >("About time" I hear someone mumbling in the audience.) One strange
> >difference was that TALES iterators swapped the meaning of odd and even,
> >i.e.
> >
> > <p tal:repeat="item python: [1, 2, 3, 4]">
> > <span tal:condition="repeat/var/odd">odd<span>
> > <span tal:condition="repeat/var/even">even<span>
> > </p>
> >
> >produces different results on Zope 3.4 than it did on 3.2.
>
> First, your example does not work (must be repeat/item instead of
> repeat/var).

Right, sorry about that.

> >Does anyone know why this is? Is this a bug? Should it be fixed?
>
> Where exactly is the bug?

Zope 3.2 produces

odd
even
odd
even

Zope 3.4 produces

even
odd
even
odd

i.e. the meanings of "odd" and "even" have switched places. As a more
concrete example, when renderin a table, the first row used to get the
"odd" CSS class, but now is getting the "even" one.

> The output is even-odd-even-odd. The even/odd methods apply to the current
> iteration number afaik - but not to the variable within the current
> iteration itself. Or?

Right. I'm now regretting my unfortunate example that used numbers as
the items to be iterated over.

Marius Gedminas
--
Read what I mean, not what I write.
Attachments: signature.asc (0.19 KB)

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.