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

Guido van Rossum guido@python.org
Tue, 18 Mar 2003 16:10:35 -0500


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

Modified Files:
      Tag: local-utility-branch
	configuration.py utility.py 
Log Message:
Another checkpoint.

=== Zope3/src/zope/app/interfaces/services/configuration.py 1.7.2.2 => 1.7.2.3 ===
--- Zope3/src/zope/app/interfaces/services/configuration.py:1.7.2.2	Tue Mar 18 11:55:46 2003
+++ Zope3/src/zope/app/interfaces/services/configuration.py	Tue Mar 18 16:10:04 2003
@@ -68,35 +68,45 @@
 
 
 class INamedConfiguration(IConfiguration):
-    """Configuration object that is registered by name
+    """Configuration object that is registered only by name.
     """
 
     name = TextLine(title=u"Name",
                     description=u"The name that is registered",
-                    required=True, readonly=True, min_length=1)
+                    readonly=True,
+                    # Don't allow empty or missing name:
+                    required=True,
+                    min_length=1,
+                    )
 
     # The label is generally set as a class attribute on the
     # configuration class.
     label = Attribute("Descriptive label of the configuration type "
                       "(for example, Service, Connection)")
 
-class INamedComponentConfiguration(INamedConfiguration):
-    """Configuration object that configures a component associated with a name
-    """
 
-    permission = PermissionField(
-        title=u"The permission needed to use the component.",
-        required=False,
-        )
+class IComponentConfiguration(IConfiguration):
+    """Configuration object that uses a component path and a permission."""
 
     componentPath = ComponentPath(
         title=u"Component path",
         description=u"The physical path to the component",
         required=True)
 
+    permission = PermissionField(
+        title=u"The permission needed to use the component.",
+        required=False,
+        )
+
     def getComponent():
         """Return the component named in the configuration.
         """
+
+
+class INamedComponentConfiguration(INamedConfiguration,
+                                   IComponentConfiguration):
+    """Components registered by name, using componemt path and permission."""
+
 
 class IConfigurationRegistry(Interface):
     """A registry of configurations for a set of parameters


=== Zope3/src/zope/app/interfaces/services/utility.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/interfaces/services/utility.py:1.1.2.3	Tue Mar 18 07:35:50 2003
+++ Zope3/src/zope/app/interfaces/services/utility.py	Tue Mar 18 16:10:04 2003
@@ -16,34 +16,39 @@
 $Id$
 """
 
-from zope.app.interfaces.services.configuration \
-     import INamedComponentConfiguration
+from zope.app.interfaces.services.configuration import IComponentConfiguration
 from zope.app.component.interfacefield import InterfaceField
 from zope.app.security.permission import PermissionField
 from zope.schema import BytesLine, TextLine
 from zope.app.interfaces.services.configuration import IUseConfigurable
 from zope.app.services.field import ComponentPath
 
-class IUtilityConfiguration(INamedComponentConfiguration):
+class IUtilityConfiguration(IComponentConfiguration):
     """Utility configuration object.
 
-    This inherits fields 'name', 'componentPath', 'permission', and
-    adds a field 'interface'.  It also inherits a method
-    getComponent().
+    This is keyed off name (which may be empty) and interface.  It
+    overrides componentPath (to make it readonly); it also inherits a
+    getComponent() method.
     """
 
-    componentPath = ComponentPath(
-        title=u"Component path",
-        description=u"The physical path to the component",
-        required=True,
-        readonly=True,
-        )
+    name = TextLine(title=u"Name",
+                    description=u"The name that is registered",
+                    readonly=True,
+                    required=True,
+                    )
 
     interface = InterfaceField(
         title = u"Provided interface",
         description = u"The interface provided by the adapter",
         readonly = True,
         required = True,
+        )
+
+    componentPath = ComponentPath(
+        title=u"Component path",
+        description=u"The physical path to the component",
+        required=True,
+        readonly=True,
         )