[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - query.py:1.7

Steve Alexander steve@cat-box.net
Thu, 6 Feb 2003 08:03:42 -0500


Update of /cvs-repository/Zope3/src/zope/app/interfaces/services
In directory cvs.zope.org:/tmp/cvs-serv16158/src/zope/app/interfaces/services

Modified Files:
	query.py 
Log Message:
Updated query interfaces.


=== Zope3/src/zope/app/interfaces/services/query.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/interfaces/services/query.py:1.6	Tue Jan  7 14:51:26 2003
+++ Zope3/src/zope/app/interfaces/services/query.py	Thu Feb  6 08:03:39 2003
@@ -22,6 +22,7 @@
 from zope.app.interfaces.services.configuration import INamedConfiguration
 from zope.app.component.interfacefield import InterfacesField
 from zope.schema.interfaces import ITuple
+# There's another import further down
 
 class IQueryProcessorsField(ITuple):
     """Field for entering a pipeline of query processors."""
@@ -48,7 +49,7 @@
     def listQueries():
         '''Returns a list of query registrations.
 
-        (query_id, permission_id, input_interface, output_interface)'''
+        Each element of the list is an IQueryListItem.'''
 
     def processQuery(query_id, input):
         '''Processes the input, using the query registered with query_id.
@@ -56,14 +57,37 @@
         The input must be adaptable to the input interfaces registered for
         the query_id.'''
 
+class IQueryListItem(Interface):
+
+    id = Attribute('The id of this query.')
+    #permission = Attribute('Permission required to run the query.'
+    #                       ' An object, not an id.')
+    #inputInterfaces = Attribute('Sequence of interfaces the input must be'
+    #                            ' adaptable to.')
+    #outputInterfaces = Attribute('Sequence of interfaces the output must be'
+    #                             ' adaptable to.')
+    permission = PermissionField(title=u'Required permission', required=False)
+
+    inputInterfaces = InterfacesField(title=u'Input interfaces',
+                                      basetype=None)
+    outputInterfaces = InterfacesField(title=u'Output interfaces',
+                                       basetype=None)
+
+# The import is here to avoid circular imports
+from zope.app.services.queryfield import QueryProcessorsField
+
 class IQueryConfigurationInfo(INamedConfigurationInfo):
 
-    permission = PermissionField(title=u'Required permission')
+    permission = PermissionField(title=u'Required permission', required=False)
     inputInterfaces = InterfacesField(title=u'Input interfaces',
                                       basetype=None)
     outputInterfaces = InterfacesField(title=u'Output interfaces',
                                        basetype=None)
+    processors = QueryProcessorsField(title=u'Query processors',
+                                      required=False)
 
 class IQueryConfiguration(IQueryConfigurationInfo, INamedConfiguration):
-    pass
+
+    def getProcessors():
+        'Returns a sequence of query processor objects.'