[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - registration.py:1.14

Naveen P pnaveen at zeomega.com
Thu Dec 18 04:57:44 EST 2003


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

Modified Files:
	registration.py 
Log Message:
Applied the containment constraints on the PluggableAuthorisationService, PrincipalSource, Registration Manager and Adapter Registration.


=== Zope3/src/zope/app/interfaces/services/registration.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/interfaces/services/registration.py:1.13	Fri Oct 17 11:49:19 2003
+++ Zope3/src/zope/app/interfaces/services/registration.py	Thu Dec 18 04:57:12 2003
@@ -18,11 +18,14 @@
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.interfaces.annotation import IAnnotatable
 from zope.app.interfaces.annotation import IAttributeAnnotatable
-from zope.app.interfaces.container  import IContainerNamesContainer, IContainer
+from zope.app.interfaces.container import IContainerNamesContainer
+from zope.app.interfaces.container import IContained, IContainer
 from zope.app.security.permission import PermissionField
 from zope.interface import Interface, Attribute, implements
-from zope.schema import TextLine
+from zope.schema import TextLine, Field
 from zope.schema.interfaces import ITextLine
+from zope.app.container.constraints import ItemTypePrecondition
+from zope.app.container.constraints import ContainerTypesConstraint
 
 UnregisteredStatus = _('Unregistered')
 RegisteredStatus = _('Registered')
@@ -122,7 +125,6 @@
     label = Attribute("Descriptive label of the registration type "
                       "(for example, Service, Connection)")
 
-
 class IComponentPath(ITextLine):
     """A component path
     """
@@ -335,11 +337,46 @@
         an active registration, and if so, returns its component.  Otherwise
         returns default.
         """
+class IOrderedContainer(Interface):
+    """Containers whose items can be reorderd.
+
+    XXX This is likely to go.
+    """
 
-class IRegisterable(IAnnotatable):
+    def moveTop(names):
+        """Move the objects corresponding to the given names to the top.
+        """
+
+    def moveUp(names):
+        """Move the objects corresponding to the given names up.
+        """
+
+    def moveBottom(names):
+        """Move the objects corresponding to the given names to the bottom.
+        """
+
+    def moveDown(names):
+        """Move the objects corresponding to the given names down.
+        """
+
+class IRegistrationManager(IContainerNamesContainer, IOrderedContainer):
+    """Manage Registrations
+    """
+
+    def __setitem__(name, object):
+        """Add to object"""
+
+class IRegisterable(IAnnotatable, IContained):
     """A marker interface."""
+    
+    __parent__ = Field(
+        constraint = ContainerTypesConstraint(IRegistrationManager))
+
+IRegistrationManager['__setitem__'].setTaggedValue(
+    'precondition', ItemTypePrecondition(IRegisterable))
+    
 
-class IRegistered(IRegisterable):
+class IRegistered(Interface):
     """An object that can keep track of its configured uses.
 
     The object need not implement this functionality itself, but must at
@@ -370,41 +407,6 @@
 
 class IAttributeRegisterable(IAttributeAnnotatable, IRegisterable):
     """A marker interface."""
-
-
-class IOrderedContainer(Interface):
-    """Containers whose items can be reorderd.
-
-    XXX This is likely to go.
-    """
-
-    def moveTop(names):
-        """Move the objects corresponding to the given names to the top.
-        """
-
-    def moveUp(names):
-        """Move the objects corresponding to the given names up.
-        """
-
-    def moveBottom(names):
-        """Move the objects corresponding to the given names to the bottom.
-        """
-
-    def moveDown(names):
-        """Move the objects corresponding to the given names down.
-        """
-
-class IRegistrationManager(IContainerNamesContainer, IOrderedContainer):
-    """Manage Registrations
-    """
-
-    def addRegistration(registration):
-        """Add a registration
-
-        The registration name is chosen automatically. The chosen name
-        is returned.
-        """
-
 
 class INoRegistrationManagerError(Interface):
     """No registration manager error




More information about the Zope3-Checkins mailing list