Am Sonntag, den 24.07.2005, 19:50 -0300 schrieb David Pratt:
> Hi Chris. I believe the purpose of ZTUtils are utility functions for 
> page templating. That said, the Iterator class could be more useful by 
> exposing its values based on its state -  the point I had made.  
> Versatility is the beautiful thing about python  - it rarely matters to 
> me what intention there is or may have been for a class so long as it 
> supplies the methods I am after.  In the end, there's really nothing 
> here that can't be solved with a simple tool and a bit of flexibility 
> on my part. Many thanks.
> Regards,
> David
> On Friday, July 22, 2005, at 02:08 PM, Chris Withers wrote:
> > David Pratt wrote:
> >>> Ah, I see what you're after, something akin to an SQL sequence, 
> >>> right?
> >>> Well, Iterator ain't that ;-)
> >> I guess something like that but that is what an iterator does.
> >
> > Why makes you think ZTUtils Iterators were designed for this?
> >
> >> Well, by hand is not the solution either.  It is not as simple as 
> >> that since I am using portlets in CMF
> >
> > You meean portlets in Plone, right? ;-)
> >
> >> You can't just number them like 1,2,3 etc because you end up with 
> >> conflicts in tabindex values when your templates are rendered.
> >
> > So give them each their own numbers based on the worst case of all 
> > portlets being present on one page...
> >
> >> your ZPT (that doesn't require you to write one with all the security 
> >> bypasses to make it work).
> >
> > They are not "security bypasses", they are appropriate security 
> > declarations based on the work the ZTUtils code does when executing...
> >
> > Looks like you're on your own...

It looks like this part of the Iterator is just misdesigned:

    def next(self):
        if not (hasattr(self, '_next') or self._prep_next(self)):
            return 0
        self.index = i = self.nextIndex
        self.nextIndex = i+1
        return 1

IIRC, ZTUtils were written long before the python iterators became
standard. So the method name next was used and now clashes with
the standard iterator protocol.

It could be fixed but only if there is no product in the world using
it or all must be fixed before.

I propose: has_next() or something in place of it.

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to