[Zodb-checkins] CVS: Zope3/src/zope/interface - implementor.py:1.9 interfaces.py:1.25 type.py:1.13

Jim Fulton jim at zope.com
Tue Mar 30 17:01:36 EST 2004


Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv10829/src/zope/interface

Modified Files:
	implementor.py interfaces.py type.py 
Log Message:
Began the deprecation of the Type and Implementor registries.
These functions are now provided by adapter registries.


=== Zope3/src/zope/interface/implementor.py 1.8 => 1.9 ===
--- Zope3/src/zope/interface/implementor.py:1.8	Fri Mar  5 17:09:28 2004
+++ Zope3/src/zope/interface/implementor.py	Tue Mar 30 17:01:34 2004
@@ -11,9 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Adapter-style interface registry
-
-See Adapter class.
+"""This module is DEPRECATED. Don't use it!
 
 $Id$
 """
@@ -21,7 +19,51 @@
 
 from zope.interface import Interface, implements
 from zope.interface.interfaces import IInterface
-from zope.interface.interfaces import IImplementorRegistry
+
+
+class IImplementorRegistry(Interface):
+    """Implementor registry
+
+    This registry stores objects registered to implement (or help
+    implement) an interface. For example, this registry could be used
+    to register utilities.
+
+    The objects registered here don't need to be implementors. (They
+    might just be useful to implementation.) What's important is that
+    they are registered according to a provided interface.
+
+    """
+
+    def register(provide, object):
+        """Register an object for a required and provided interface.
+
+        There are no restrictions on what the object might be.
+        Any restrictions (e.g. callability, or interface
+        implementation) must be enforced by higher-level code.
+
+        The require argument may be None.
+
+        """
+
+    def get(provides, default=None):
+        """Return a registered object
+
+        The registered object is one that was registered that provides an
+        interface that extends or equals the 'provides' argument.
+
+        """
+
+    def getRegisteredMatching():
+        """Return a sequence of two-tuples, each tuple consisting of:
+
+        - interface
+
+        - registered object
+
+        One item is returned for each registration.
+
+        """
+
 
 class ImplementorRegistry:
     """Implementor-style interface registry


=== Zope3/src/zope/interface/interfaces.py 1.24 => 1.25 ===
--- Zope3/src/zope/interface/interfaces.py:1.24	Tue Mar 30 16:40:00 2004
+++ Zope3/src/zope/interface/interfaces.py	Tue Mar 30 17:01:34 2004
@@ -272,101 +272,6 @@
 
     __module__ = Attribute("""The name of the module defining the interface""")
 
-class ITypeRegistry(Interface):
-    """Type-specific registry
-
-    This registry stores objects registered for objects that implement
-    a required interface.
-    """
-
-    def register(interface, object):
-        """Register an object for an interface.
-
-        The interface argument may be None.  This effectively defines a
-        default object.
-        """
-
-    def unregister(interface):
-        """Remove the registration for the given interface
-
-        If nothing is registered for the interface, the call is ignored.
-        """
-
-    def get(interface, default=None):
-        """Return the object registered for the given interface.
-        """
-
-    def getAll(implements):
-        """Get registered objects
-
-        Return a sequence of all objects registered with interfaces
-        that are extended by or equal to one or more interfaces in the
-        given interface specification.
-
-        Objects that match more specific interfaces of the specification
-        come before those that match less specific interfaces, as per
-        the interface resolution order described in the flattened() operation
-        of IInterfaceSpecification.
-        """
-
-    def getAllForObject(object):
-        """Get all registered objects for types that object implements.
-        """
-
-    def getTypesMatching(interface):
-        """Get all registered interfaces matching the given interface
-
-        Returns a sequence of all interfaces registered that extend
-        or are equal to the given interface.
-        """
-
-    def __len__():
-        """Returns the number of distinct interfaces registered.
-        """
-
-class IImplementorRegistry(Interface):
-    """Implementor registry
-
-    This registry stores objects registered to implement (or help
-    implement) an interface. For example, this registry could be used
-    to register utilities.
-
-    The objects registered here don't need to be implementors. (They
-    might just be useful to implementation.) What's important is that
-    they are registered according to a provided interface.
-
-    """
-
-    def register(provide, object):
-        """Register an object for a required and provided interface.
-
-        There are no restrictions on what the object might be.
-        Any restrictions (e.g. callability, or interface
-        implementation) must be enforced by higher-level code.
-
-        The require argument may be None.
-
-        """
-
-    def get(provides, default=None):
-        """Return a registered object
-
-        The registered object is one that was registered that provides an
-        interface that extends or equals the 'provides' argument.
-
-        """
-
-    def getRegisteredMatching():
-        """Return a sequence of two-tuples, each tuple consisting of:
-
-        - interface
-
-        - registered object
-
-        One item is returned for each registration.
-
-        """
-
 class IDeclaration(ISpecification):
     """Interface declaration
 


=== Zope3/src/zope/interface/type.py 1.12 => 1.13 ===
--- Zope3/src/zope/interface/type.py:1.12	Fri Mar  5 17:09:29 2004
+++ Zope3/src/zope/interface/type.py	Tue Mar 30 17:01:34 2004
@@ -11,9 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Adapter-style interface registry
-
-See Adapter class.
+"""This module is DEPRECATED. Don't use it!
 
 $Id$
 """
@@ -21,9 +19,60 @@
 
 import zope.interface
 import types
-from zope.interface import providedBy, implements
+from zope.interface import providedBy, implements, Interface
 from zope.interface.interfaces import IInterface
-from zope.interface.interfaces import ITypeRegistry
+
+class ITypeRegistry(Interface):
+    """Type-specific registry
+
+    This registry stores objects registered for objects that implement
+    a required interface.
+    """
+
+    def register(interface, object):
+        """Register an object for an interface.
+
+        The interface argument may be None.  This effectively defines a
+        default object.
+        """
+
+    def unregister(interface):
+        """Remove the registration for the given interface
+
+        If nothing is registered for the interface, the call is ignored.
+        """
+
+    def get(interface, default=None):
+        """Return the object registered for the given interface.
+        """
+
+    def getAll(implements):
+        """Get registered objects
+
+        Return a sequence of all objects registered with interfaces
+        that are extended by or equal to one or more interfaces in the
+        given interface specification.
+
+        Objects that match more specific interfaces of the specification
+        come before those that match less specific interfaces, as per
+        the interface resolution order described in the flattened() operation
+        of IInterfaceSpecification.
+        """
+
+    def getAllForObject(object):
+        """Get all registered objects for types that object implements.
+        """
+
+    def getTypesMatching(interface):
+        """Get all registered interfaces matching the given interface
+
+        Returns a sequence of all interfaces registered that extend
+        or are equal to the given interface.
+        """
+
+    def __len__():
+        """Returns the number of distinct interfaces registered.
+        """
 
 class TypeRegistry:
 




More information about the Zodb-checkins mailing list