Can I contribute a small TabindexIterator class for ZTUtils. It is not big, but handy for generating tabindex values in a site. The current Iterator class available was not meant to do this but this is. I think this could be added to It seems better to incorporate something like this in ZTUtils than making a site tool to do this.

It only provides one method next() and takes a sequence. If you want your tabindex to start at 500 and go no further than 599, you just give it range(500,600) and stops iterating. For for 0 to n - just use range(n). It could always pass after iteration stops but I think it is better to raise exception so you can modify your sequence, if necessary.

class TabindexIterator:
        """ Tabindex iterator class """
        __allow_access_to_unprotected_subobjects__ = 1
        def __init__(self, seq):                
                self.iter = seq.__iter__()
        def next(self):
                        next =
                        return next
                except StopIteration:
                        raise 'Tabindex iterator exhausted.'

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

Reply via email to