[Zope3-checkins] SVN: Zope3/trunk/src/zope/schema/interfaces.py -
add IIterableChoice and note the desire to depricate vocabularies
Benji York
benji at zope.com
Fri Sep 2 16:14:33 EDT 2005
Log message for revision 38249:
- add IIterableChoice and note the desire to depricate vocabularies
Changed:
U Zope3/trunk/src/zope/schema/interfaces.py
-=-
Modified: Zope3/trunk/src/zope/schema/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/schema/interfaces.py 2005-09-02 20:13:02 UTC (rev 38248)
+++ Zope3/trunk/src/zope/schema/interfaces.py 2005-09-02 20:14:33 UTC (rev 38249)
@@ -17,8 +17,8 @@
"""
from zope.interface import Interface, Attribute
+from zope.schema._bootstrapfields import Container, Iterable
from zope.schema._bootstrapfields import Field, Text, TextLine, Bool, Int
-from zope.schema._bootstrapfields import Container, Iterable
from zope.i18nmessageid import MessageIDFactory
_ = MessageIDFactory("zope")
@@ -523,6 +523,21 @@
If 'value' is not a valid term, this method raises LookupError.
"""
+
+class IIterableSource(Interface):
+ """Source which supports iteration over allowed values.
+
+ The objects iteration provides must be values from the source.
+ """
+
+ def __iter__():
+ """Return an iterator which provides the values from the source."""
+
+ def __len__():
+ """Return the number of valid values, or sys.maxint."""
+
+
+# BBB vocabularies are pending deprecation, hopefully in 3.2
class IIterableVocabulary(Interface):
"""Vocabulary which supports iteration over allowed values.
More information about the Zope3-Checkins
mailing list