[Zope3-checkins] CVS: Zope3/src/zope/schema - interfaces.py:1.19

Fred L. Drake, Jr. fred@zope.com
Wed, 28 May 2003 13:09:03 -0400


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv24453/schema

Modified Files:
	interfaces.py 
Log Message:
Enhance the basic vocab interfaces to support non-string values.
Changes to the widgets will be done later today.


=== Zope3/src/zope/schema/interfaces.py 1.18 => 1.19 ===
--- Zope3/src/zope/schema/interfaces.py:1.18	Wed May 28 10:34:28 2003
+++ Zope3/src/zope/schema/interfaces.py	Wed May 28 13:09:03 2003
@@ -447,6 +447,31 @@
         "value", "The value used to represent vocabulary term in a field.")
 
 
+class ITokenizedTerm(ITerm):
+    """Object representing a single value in a tokenized vocabulary.
+    """
+
+    token = Attribute(
+        "token",
+        """Token which can be used to represent the value on a stream.
+
+        The value of this attribute must be a 7-bit string.
+        """)
+
+
+class IVocabularyTokenized(Interface):
+    """Vocabulary that provides support for tokenized representation.
+
+    This interface must be used as a mix-in with IBaseVocabulary.
+
+    Terms returned from getTerm() and provided by iteration must
+    conform to ITokenizedTerm.
+    """
+
+    def getTermByToken(token):
+        """Return an ITokenizedTerm for the passed-in token."""
+
+
 class IIterableVocabulary(Interface):
     """Vocabulary which supports iteration over allowed values.