[Zope3-checkins] CVS: Zope3/src/zope/schema - interfaces.py:1.15.4.3 vocabulary.py:1.1.2.4

Fred L. Drake, Jr. fred@zope.com
Fri, 16 May 2003 11:59:17 -0400


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

Modified Files:
      Tag: schema-vocabulary-branch
	interfaces.py vocabulary.py 
Log Message:
Change the way queryable vocabularies are handled; queryability will no
longer be indicated by specialized interfaces on the vocab, but by the
getQuery() method returning a non-None value.  The returned object can be
used with the component architecture to get useful adapters and view-helpers.


=== Zope3/src/zope/schema/interfaces.py 1.15.4.2 => 1.15.4.3 ===
--- Zope3/src/zope/schema/interfaces.py:1.15.4.2	Thu May  8 12:00:11 2003
+++ Zope3/src/zope/schema/interfaces.py	Fri May 16 11:58:46 2003
@@ -407,11 +407,26 @@
     vocabularies which are intrinsically ordered).
     """
 
+    def getQuery():
+        """Return an IVocabularyQuery object for this vocabulary.
+
+        Vocabularies which do not support query must return None.
+        """
+
     def getTerm(value):
         """Return the ITerm object for the term 'value'.
 
         If 'value' is not a valid term, this method raises LookupError.
         """
+
+class IVocabularyQuery(Interface):
+    """Query object for a vocabulary.
+
+    This is a marker interface for query objects; specific
+    implementations must derive a more specific interface and
+    implement that.  Widget views should be registered for the
+    specific interface.
+    """
 
 
 class ITerm(Interface):


=== Zope3/src/zope/schema/vocabulary.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/schema/vocabulary.py:1.1.2.3	Wed May  7 16:50:20 2003
+++ Zope3/src/zope/schema/vocabulary.py	Fri May 16 11:58:46 2003
@@ -26,13 +26,6 @@
     from types import StringTypes as basestring
 
 
-class IExampleQueryableVocabulary(IAbstractVocabulary):
-    # XXX Example only
-
-    def query(pattern):
-        """Return ISubsetVocabulary with values that match pattern."""
-
-
 class VocabularyField(Field):
     """Field that adds support for use of an external vocabulary.