[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - utility.py:1.8

Sidnei da Silva sidnei at x3ng.com.br
Wed Aug 6 18:17:13 EDT 2003


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

Modified Files:
	utility.py 
Log Message:
Finally got my own mini-geddon.

Changes:

 - Spiced up a bit the Utility service getRegisteredMatching to allow querying by interface and name.
 - Added getUtilitiesFor(interface) to the utility service, to allow querying for a list of utilities that provide an interface.
 - Made the local and global interface services delegate to the utility service when querying for available interfaces. This is done by querying for utilities that provide IInterface. In the future (read: later this week) this will allow us to have persistent interfaces registered as local utilities, a.k.a. TTW Schema.
 - Added tests for all of this, and run the test suite twice to make sure :)



=== Zope3/src/zope/app/interfaces/services/utility.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/interfaces/services/utility.py:1.7	Sat Jun 21 17:22:10 2003
+++ Zope3/src/zope/app/interfaces/services/utility.py	Wed Aug  6 17:16:38 2003
@@ -73,9 +73,8 @@
     Methods which must be implemented by a local utility service to
     allow views to retrieve sufficient information from the service.
     """
-
-    def getRegisteredMatching():
-        """Return the registrations.
+    def getRegisteredMatching(interface=None, name=None):
+        """Return the registered utilities.
 
         The return value is an iterable object for which each item
         is a three-element tuple:
@@ -87,4 +86,11 @@
         - registration stack
 
         One item is present for each registration.
+
+        If interface is None, all registered registrations are returned.
+        Otherwise, only registrations that provide the given interface
+        are returned.
+
+        Also, if name is provided and is contained in the name of the
+        registered utility, we use that to filter the returned values.
         """




More information about the Zope3-Checkins mailing list