diff options
author | Jim Fulton <jim@zope.com> | 2003-05-20 20:28:02 +0000 |
---|---|---|
committer | Jim Fulton <jim@zope.com> | 2003-05-20 20:28:02 +0000 |
commit | 43c281c260651a53ec6570aed7c14cf356733dcb (patch) | |
tree | 068fefbc35c62a99c2f9e105e6a9dc6e390536ed | |
parent | 34bf64b5f5ed9e790d6f71ced70b8a79cf76c59f (diff) | |
download | zope-pagetemplate-43c281c260651a53ec6570aed7c14cf356733dcb.tar.gz |
Removed the iterator module from the zope.pagetemplate package. The
code moved to zope.tales.tales.
-rw-r--r-- | __init__.py | 2 | ||||
-rw-r--r-- | iterator.py | 80 |
2 files changed, 0 insertions, 82 deletions
diff --git a/__init__.py b/__init__.py index 208249a..711cb63 100644 --- a/__init__.py +++ b/__init__.py @@ -12,5 +12,3 @@ # ############################################################################## """Page Templates""" - -from zope.pagetemplate.iterator import Iterator diff --git a/iterator.py b/iterator.py deleted file mode 100644 index a4b1076..0000000 --- a/iterator.py +++ /dev/null @@ -1,80 +0,0 @@ -############################################################################## -# -# Copyright (c) 2001, 2002 Zope Corporation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -__doc__='''Iterator class - -$Id: iterator.py,v 1.2 2002/12/25 14:15:13 jim Exp $''' -__version__='$Revision: 1.2 $'[11:-2] - -class Iterator: - '''Simple Iterator class''' - - __allow_access_to_unprotected_subobjects__ = 1 - - def __init__(self, seq): - self.seq = seq - self.nextIndex = 0 - - def next(self): - i = self.nextIndex - try: - self.seq[i] - except IndexError: - return 0 - self.index = i - self.nextIndex = i+1 - return 1 - - def number(self): return self.nextIndex - - def even(self): return not self.index % 2 - - def odd(self): return self.index % 2 - - def letter(self, base=ord('a'), radix=26): - index = self.index - s = '' - while 1: - index, off = divmod(index, radix) - s = chr(base + off) + s - if not index: return s - - def Letter(self): - return self.letter(base=ord('A')) - - def Roman(self, rnvalues=( - (1000,'M'),(900,'CM'),(500,'D'),(400,'CD'), - (100,'C'),(90,'XC'),(50,'L'),(40,'XL'), - (10,'X'),(9,'IX'),(5,'V'),(4,'IV'),(1,'I')) ): - n = self.index + 1 - s = '' - for v, r in rnvalues: - rct, n = divmod(n, v) - s = s + r * rct - return s - - def roman(self): - return self.Roman.lower() - - def start(self): return self.nextIndex == 1 - - def end(self): - try: self.seq[self.nextIndex] - except IndexError: return 1 - return 0 - - def item(self): - return self.seq[self.index] - - def length(self): - return len(self.seq) |