[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/ Redeprecated some things that weren't properly deprecated before and

Jim Fulton jim at zope.com
Sun Mar 12 16:46:57 EST 2006


Log message for revision 65932:
  Redeprecated some things that weren't properly deprecated before and
  started deprecating the older local-registration apis.
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/component/README.txt
  A   Zope3/branches/jim-adapter/src/zope/app/component/back35.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/bbb/hooks.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/bbb/site.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/interface.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/interfaces/__init__.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/interfaces/registration.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/tests/test_site.py
  A   Zope3/branches/jim-adapter/src/zope/app/testing/back35.py
  U   Zope3/branches/jim-adapter/src/zope/app/testing/setup.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/component/README.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/README.txt	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/README.txt	2006-03-12 21:46:56 UTC (rev 65932)
@@ -69,7 +69,7 @@
   >>> component.getNextSiteManager(object())
   Traceback (most recent call last):
   ...
-  ComponentLookupError: 'No more site managers have been found.'
+  ComponentLookupError: No more site managers have been found.
 
 If you use the `queryNextSiteManager()` function, you can specify a `default`
 return value:
@@ -120,8 +120,8 @@
   Traceback (most recent call last):
   ...  
   ComponentLookupError: 
-  "No more utilities for <InterfaceClass __builtin__.IMyUtility>, 
-  'myutil' have been found."
+  No more utilities for <InterfaceClass __builtin__.IMyUtility>, 
+  'myutil' have been found.
 
 or you can simply use the `queryNextUtility` and specify a default:
 

Added: Zope3/branches/jim-adapter/src/zope/app/component/back35.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/back35.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/back35.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -0,0 +1,315 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Features that will go away in Zope 3.5.
+
+$Id$
+"""
+
+from zope import interface, schema
+import zope.component.interfaces
+import zope.app.component.interfaces.registration
+import zope.schema.vocabulary
+from zope.app.i18n import ZopeMessageFactory as _
+import zope.app.container.interfaces
+import zope.app.container.constraints
+
+InactiveStatus = _('Inactive')
+ActiveStatus = _('Active')
+
+class IRegistration(interface.Interface):
+    """Registration object
+
+    A registration object represents a specific registration
+    decision, such as registering an adapter or defining a permission.
+
+    In addition to the attributes or methods defined here,
+    registration objects will include additional attributes
+    identifying how they should be used. For example, a service
+    registration will provide a service type. An adapter
+    registration will specify a used-for interface and a provided
+    interface.
+    """
+
+    status = schema.Choice(
+        title=_("Registration status"),
+        vocabulary= zope.schema.vocabulary.SimpleVocabulary(
+            (zope.schema.vocabulary.SimpleTerm(InactiveStatus,
+                                               title=InactiveStatus),
+             zope.schema.vocabulary.SimpleTerm(ActiveStatus,
+                                               title=ActiveStatus))),
+        default=ActiveStatus
+        )
+
+
+class IComponentRegistration(IRegistration):
+    """Registration object that uses a component.
+
+    An interface can optionally be specified that describes the interface the
+    component provides for the registry.
+    
+    The interface will be used to produce a proxy for the component, if
+    the permission is also specified.
+    """
+    component = zope.app.component.interfaces.registration.Component(
+        title=_("Registration Component"),
+        description=_("The component the registration is for."),
+        required=True)
+
+    interface = schema.Field(
+        title=_("Component Interface"),
+        description=_("The interface the component provides through this "
+                      "registration."),
+        required=False,
+        default=None)
+
+    permission = schema.Choice(
+        title=_("The permission needed to use the component"),
+        vocabulary="Permissions",
+        required=False
+        )
+
+
+class IRegistry(zope.component.interfaces.IRegistry):
+    """A component that can be configured using a registration manager."""
+
+    def register(registration):
+        """Register a component with the registry using a registration.
+
+        Once the registration is added to the registry, it will be active. If
+        the registration is already registered with the registry, this method
+        will quietly return.
+        """
+
+    def unregister(registration):
+        """Unregister a component from the registry.
+
+        Unregistering a registration automatically makes the component
+        inactive. If the registration is not registered, this method will
+        quietly return.
+        """
+
+    def registered(registration):
+        """Determine whether a registration is registered with the registry.
+
+        The method will return a Boolean value.
+        """
+
+
+class ILocatedRegistry(IRegistry):
+    """A registry that is located in a tree of registries.
+
+    
+    """
+    next = interface.Attribute(
+        "Set the next local registry in the tree. This attribute "
+        "represents the parent of this registry node. If the "
+        "value is `None`, then this registry represents the "
+        "root of the tree")
+
+    subs = interface.Attribute(
+        "A collection of registries that describe the next level "
+        "of the registry tree. They are the children of this "
+        "registry node. This attribute should never be "
+        "manipulated manually. Use `addSub()` and `removeSub()` "
+        "instead.")
+
+    base = interface.Attribute(
+        "Outside of the local registry tree lies the global "
+        "registry, which is known as the base to every local "
+        "registry in the tree.")
+
+    def addSub(sub):
+        """Add a new sub-registry to the node.
+
+        Important: This method should *not* be used manually. It is
+        automatically called by `setNext()`. To add a new registry to the
+        tree, use `sub.setNext(self, self.base)` instead!
+        """
+
+    def removeSub(sub):
+        """Remove a sub-registry to the node.
+
+        Important: This method should *not* be used manually. It is
+        automatically called by `setNext()`. To remove a registry from the
+        tree, use `sub.setNext(None)` instead!
+        """
+
+    def setNext(next, base=None):
+        """Set the next/parent registry in the tree.
+
+        This method should ensure that all relevant registies are updated
+        correctly as well.
+        """
+
+
+class IRegistrationManager(
+    zope.app.container.interfaces.IContainerNamesContainer,
+    ):
+    """Manage Registrations"""
+    zope.app.container.constraints.contains(IRegistration)
+
+    def addRegistration(registration):
+        """Add a registration to the manager.
+
+        The function will automatically choose a name as which the
+        registration will be known. The name of the registration inside this
+        manager is returned.
+        """
+
+
+class IRegistrationManagerContained(zope.app.container.interfaces.IContained):
+    """Objects that can be contained by the registration manager should
+    implement this interface."""
+    zope.app.container.constraints.containers(IRegistrationManager)
+
+
+class IRegisterableContainer(zope.app.container.interfaces.IContainer):
+    """Containers with registration managers
+
+    These are site-management folders of one sort or another.
+
+    The container allows clients to access the registration manager
+    without knowing it's name.
+
+    The registration manager container *also* supports local-module
+    lookup.
+    """
+
+    registrationManager = schema.Field(
+        title=_("Registration Manager"),
+        description=_("The registration manager keeps track of all component "
+                    "registrations."))
+
+
+class IRegisterable(zope.app.container.interfaces.IContained):
+    """Mark a component as registerable.
+
+    All registerable components need to implement this interface. 
+    """
+    zope.app.container.constraints.containers(IRegisterableContainer)
+
+
+class IRegisterableContainerContaining(
+    zope.app.container.interfaces.IContainer,
+    ):
+    """A container that can only contain `IRegisterable`s and
+    `IRegisterableContainer`s.
+
+    This interface was designed to be always used together with the
+    `IRegisterableContainer`.
+    """
+    zope.app.container.constraints.contains(
+        IRegisterable, IRegisterableContainer)
+    
+
+class IRegistered(interface.Interface):
+    """An object that can track down its registrations.
+
+    The object need not implement this functionality itself, but must at
+    least support doing so via an adapter.
+    """
+
+    def registrations():
+        """Return a sequence of registration objects for this object."""
+
+class ILocalAdapterRegistry(IRegistry, ILocatedRegistry):
+    pass
+
+class ILocalUtility(IRegisterable):
+    """Local utility marker.
+
+    A marker interface that indicates that a component can be used as
+    a local utility.
+
+    Utilities should usually also declare they implement
+    IAttributeAnnotatable, so that the standard adapter to
+    IRegistered can be used; otherwise, they must provide
+    another way to be adaptable to IRegistered.
+    """
+
+class IAdapterRegistration(IComponentRegistration):
+    """Local Adapter Registration for Local Adapter Registry
+
+    The adapter registration is used to provide local adapters via the
+    adapter registry. It is an extended component registration, whereby the
+    component is the adapter factory in this case.
+    """
+    required = schema.Choice(
+        title = _("For interface"),
+        description = _("The interface of the objects being adapted"),
+        vocabulary="Interfaces",
+        readonly = True,
+        required=False,
+        default=None)
+
+    with = schema.Tuple(
+        title = _("With interfaces"),
+        description = _("Additionally required interfaces"),
+        readonly=True,
+        value_type = zope.schema.Choice(vocabulary='Interfaces'),
+        required=False,
+        default=())
+
+    provided = schema.Choice(
+        title = _("Provided interface"),
+        description = _("The interface provided"),
+        vocabulary="Interfaces",
+        readonly = True,
+        required = True)
+
+    name = schema.TextLine(
+        title=_(u"Name"),
+        readonly=False,
+        required=True,
+        default=u''
+        )
+
+    permission = schema.Choice(
+        title=_("The permission required for use"),
+        vocabulary="Permission Ids",
+        readonly=False,
+        required=False,
+        )
+
+    # TODO: for now until we figure out a way to specify the factory directly
+    factoryName = schema.TextLine(
+        title=_(u"Factory Name"),
+        readonly=False,
+        required=False,
+        )
+
+class IUtilityRegistration(IAdapterRegistration):
+    """Utility registration object.
+
+    Adapter registries are also used to to manage utilities, since utilities
+    are adapters that are instantiated and have no required interfaces. Thus,
+    utility registrations must fulfill all requirements of an adapter
+    registration as well.
+    """
+
+    name = zope.schema.TextLine(
+        title=_("Register As"),
+        description=_("The name under which the utility will be known."),
+        readonly=False,
+        required=True,
+        default=u''
+        )
+
+    provided = zope.schema.Choice(
+        title=_("Provided interface"),
+        description=_("The interface provided by the utility"),
+        vocabulary="Utility Component Interfaces",
+        readonly=True,
+        required=True,
+        )


Property changes on: Zope3/branches/jim-adapter/src/zope/app/component/back35.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/branches/jim-adapter/src/zope/app/component/bbb/hooks.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/bbb/hooks.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/bbb/hooks.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -16,7 +16,7 @@
 $Id: hooks.py 29143 2005-02-14 22:43:16Z srichter $
 """
 from zope.component import getSiteManager
-from zope.component.bbb import service
+from zope.component import service
 
 def getServices_hook(context=None):
     sm = getSiteManager(context)

Modified: Zope3/branches/jim-adapter/src/zope/app/component/bbb/site.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/bbb/site.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/bbb/site.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -17,7 +17,7 @@
 """
 __docformat__ = "reStructuredText"
 import zope.deprecation
-from zope.component.bbb.service import IService
+from zope.component.service import IService
 from zope.cachedescriptors import property
 
 from zope.app import zapi

Modified: Zope3/branches/jim-adapter/src/zope/app/component/interface.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/interface.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/interface.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -120,7 +120,7 @@
     >>> getInterface(None, 'zope.app.component.interface.I4')
     Traceback (most recent call last):
     ...
-    ComponentLookupError: 'zope.app.component.interface.I4'
+    ComponentLookupError: zope.app.component.interface.I4
     >>> provideInterface('', I4, IContentType)
     >>> IContentType.providedBy(I4)
     True

Modified: Zope3/branches/jim-adapter/src/zope/app/component/interfaces/__init__.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/interfaces/__init__.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/interfaces/__init__.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -15,19 +15,26 @@
 
 $Id$
 """
+
+
 import zope.interface
-import zope.schema
-import zope.component
-from zope.app.container.interfaces import IContainer
-from zope.app.container.constraints import ContainerTypesConstraint
-from zope.app.container.constraints import ItemTypePrecondition
+import zope.component.interfaces
+import zope.app.container.interfaces
+import zope.app.container.constraints
 from zope.app.i18n import ZopeMessageFactory as _
 import registration
 
-class ILocalAdapterRegistry(registration.IRegistry,
-                            registration.ILocatedRegistry):
-    pass
+import zope.deferredimport
 
+zope.deferredimport.deprecatedFrom(
+    "Local registration is now much simpler.  The old baroque APIs "
+    "will go away in Zope 3.5.  See the new component-registration APIs "
+    "defined in zope.component, especially IComponentRegistry.",
+    'zope.app.component.back35',
+    'ILocalAdapterRegistry', 'ILocalUtility', 'IAdapterRegistration',
+    'IUtilityRegistration',
+    )
+
 class IPossibleSite(zope.interface.Interface):
     """An object that could be a site
     """
@@ -45,125 +52,32 @@
 class ISite(IPossibleSite):
     """Marker interface to indicate that we have a site"""
 
-class ILocalSiteManager(zope.component.interfaces.ISiteManager,
-                        registration.ILocatedRegistry,
-                        registration.IRegistry):
-    """Site Managers act as containers for registerable components.
-
-    If a Site Manager is asked for an adapter or utility, it checks for those
-    it contains before using a context-based lookup to find another site
-    manager to delegate to.  If no other site manager is found they defer to
-    the global site manager which contains file based utilities and adapters.
+class INewLocalSite(zope.interface.Interface):
+    """Event: a local site was created
     """
 
-class INewLocalSite(zope.interface.Interface):
-
     manager = zope.interface.Attribute("The new site manager")
 
 class NewLocalSite:
+    """Event: a local site was created
+    """
     zope.interface.implements(INewLocalSite)
     
     def __init__(self, manager):
         self.manager = manager
 
 
-class ISiteManagementFolder(registration.IRegisterableContainer,
-                            IContainer):
-    """Component and component registration containers."""
+class ILocalSiteManager(zope.component.interfaces.IComponents):
+    """Site Managers act as containers for registerable components.
 
-    __parent__ = zope.schema.Field(
-        constraint = ContainerTypesConstraint(
-            ILocalSiteManager,
-            registration.IRegisterableContainer,
-            ),
-        )
-
-class ILocalUtility(registration.IRegisterable):
-    """Local utility marker.
-
-    A marker interface that indicates that a component can be used as
-    a local utility.
-
-    Utilities should usually also declare they implement
-    IAttributeAnnotatable, so that the standard adapter to
-    IRegistered can be used; otherwise, they must provide
-    another way to be adaptable to IRegistered.
+    If a Site Manager is asked for an adapter or utility, it checks for those
+    it contains before using a context-based lookup to find another site
+    manager to delegate to.  If no other site manager is found they defer to
+    the global site manager which contains file based utilities and adapters.
     """
 
+class ISiteManagementFolder(zope.app.container.interfaces.IContainer):
+    """Component and component registration containers."""
 
-class IAdapterRegistration(registration.IComponentRegistration):
-    """Local Adapter Registration for Local Adapter Registry
+    zope.app.container.constraints.containers(ILocalSiteManager)
 
-    The adapter registration is used to provide local adapters via the
-    adapter registry. It is an extended component registration, whereby the
-    component is the adapter factory in this case.
-    """
-    required = zope.schema.Choice(
-        title = _("For interface"),
-        description = _("The interface of the objects being adapted"),
-        vocabulary="Interfaces",
-        readonly = True,
-        required=False,
-        default=None)
-
-    with = zope.schema.Tuple(
-        title = _("With interfaces"),
-        description = _("Additionally required interfaces"),
-        readonly=True,
-        value_type = zope.schema.Choice(vocabulary='Interfaces'),
-        required=False,
-        default=())
-
-    provided = zope.schema.Choice(
-        title = _("Provided interface"),
-        description = _("The interface provided"),
-        vocabulary="Interfaces",
-        readonly = True,
-        required = True)
-
-    name = zope.schema.TextLine(
-        title=_(u"Name"),
-        readonly=False,
-        required=True,
-        default=u''
-        )
-
-    permission = zope.schema.Choice(
-        title=_("The permission required for use"),
-        vocabulary="Permission Ids",
-        readonly=False,
-        required=False,
-        )
-
-    # TODO: for now until we figure out a way to specify the factory directly
-    factoryName = zope.schema.TextLine(
-        title=_(u"Factory Name"),
-        readonly=False,
-        required=False,
-        )
-
-
-class IUtilityRegistration(IAdapterRegistration):
-    """Utility registration object.
-
-    Adapter registries are also used to to manage utilities, since utilities
-    are adapters that are instantiated and have no required interfaces. Thus,
-    utility registrations must fulfill all requirements of an adapter
-    registration as well.
-    """
-
-    name = zope.schema.TextLine(
-        title=_("Register As"),
-        description=_("The name under which the utility will be known."),
-        readonly=False,
-        required=True,
-        default=u''
-        )
-
-    provided = zope.schema.Choice(
-        title=_("Provided interface"),
-        description=_("The interface provided by the utility"),
-        vocabulary="Utility Component Interfaces",
-        readonly=True,
-        required=True,
-        )

Modified: Zope3/branches/jim-adapter/src/zope/app/component/interfaces/registration.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/interfaces/registration.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/interfaces/registration.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -15,25 +15,34 @@
 
 $Id$
 """
-import zope.component.interfaces
-from zope.interface import Interface, Attribute, implements
-from zope.schema import Field, Choice, vocabulary
-from zope.schema.interfaces import IField
 
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.container.interfaces import IContainerNamesContainer
-from zope.app.container.interfaces import IContained, IContainer
-from zope.app.container.constraints import contains, containers
-from zope.app.event.interfaces import IObjectEvent
-from zope.app.i18n import ZopeMessageFactory as _
+from zope import interface, schema
+import zope.schema.interfaces
+import zope.app.event.interfaces
 
-from zope.app.component import bbb
+import zope.deferredimport
 
-InactiveStatus = _('Inactive')
-ActiveStatus = _('Active')
+zope.deferredimport.deprecatedFrom(
+    "Local registration is now much simpler.  The old baroque APIs "
+    "will go away in Zope 3.5.  See the new component-registration APIs "
+    "defined in zope.component, especially IComponentRegistry.",
+    'zope.app.component.back35',
+    'IRegistration',
+    'InactiveStatus',
+    'ActiveStatus',
+    'IComponentRegistration',
+    'IRegistry',
+    'ILocatedRegistry',
+    'IRegistrationManager',
+    'IRegistrationManagerContained',
+    'IRegisterableContainer',
+    'IRegisterable',
+    'IRegisterableContainerContaining',
+    'IRegistered',
+    )
 
 
-class IRegistrationEvent(IObjectEvent):
+class IRegistrationEvent(zope.app.event.interfaces.IObjectEvent):
     """An event that involves a registration"""
 
 class IRegistrationActivatedEvent(IRegistrationEvent):
@@ -43,203 +52,18 @@
     """This event is fired, when a component's registration is deactivated."""
 
 
-class IRegistration(Interface):
-    """Registration object
-
-    A registration object represents a specific registration
-    decision, such as registering an adapter or defining a permission.
-
-    In addition to the attributes or methods defined here,
-    registration objects will include additional attributes
-    identifying how they should be used. For example, a service
-    registration will provide a service type. An adapter
-    registration will specify a used-for interface and a provided
-    interface.
-    """
-
-    status = Choice(
-        title=_("Registration status"),
-        vocabulary=vocabulary.SimpleVocabulary(
-            (vocabulary.SimpleTerm(InactiveStatus, title=InactiveStatus),
-             vocabulary.SimpleTerm(ActiveStatus, title=ActiveStatus))),
-        default=ActiveStatus
-        )
-
-class IComponent(IField):
+class IComponent(zope.schema.interfaces.IField):
     """A component path
 
     This is just the interface for the ComponentPath field below.  We'll use
     this as the basis for looking up an appropriate widget.
     """
 
-class Component(Field):
+class Component(schema.Field):
     """A component path
 
     Values of the field are absolute unicode path strings that can be
     traversed to get an object.
     """
-    implements(IComponent)
+    interface.implements(IComponent)
 
-
-class IComponentRegistration(IRegistration):
-    """Registration object that uses a component.
-
-    An interface can optionally be specified that describes the interface the
-    component provides for the registry.
-    
-    The interface will be used to produce a proxy for the component, if
-    the permission is also specified.
-    """
-    component = Component(
-        title=_("Registration Component"),
-        description=_("The component the registration is for."),
-        required=True)
-
-    interface = Field(
-        title=_("Component Interface"),
-        description=_("The interface the component provides through this "
-                      "registration."),
-        required=False,
-        default=None)
-
-    permission = Choice(
-        title=_("The permission needed to use the component"),
-        vocabulary="Permissions",
-        required=False
-        )
-
-
-class IRegistry(zope.component.interfaces.IRegistry):
-    """A component that can be configured using a registration manager."""
-
-    def register(registration):
-        """Register a component with the registry using a registration.
-
-        Once the registration is added to the registry, it will be active. If
-        the registration is already registered with the registry, this method
-        will quietly return.
-        """
-
-    def unregister(registration):
-        """Unregister a component from the registry.
-
-        Unregistering a registration automatically makes the component
-        inactive. If the registration is not registered, this method will
-        quietly return.
-        """
-
-    def registered(registration):
-        """Determine whether a registration is registered with the registry.
-
-        The method will return a Boolean value.
-        """
-
-
-class ILocatedRegistry(zope.component.interfaces.IRegistry):
-    """A registry that is located in a tree of registries.
-
-    
-    """
-    next = Attribute("Set the next local registry in the tree. This attribute "
-                     "represents the parent of this registry node. If the "
-                     "value is `None`, then this registry represents the "
-                     "root of the tree")
-
-    subs = Attribute("A collection of registries that describe the next level "
-                     "of the registry tree. They are the children of this "
-                     "registry node. This attribute should never be "
-                     "manipulated manually. Use `addSub()` and `removeSub()` "
-                     "instead.")
-
-    base = Attribute("Outside of the local registry tree lies the global "
-                     "registry, which is known as the base to every local "
-                     "registry in the tree.")
-
-    def addSub(sub):
-        """Add a new sub-registry to the node.
-
-        Important: This method should *not* be used manually. It is
-        automatically called by `setNext()`. To add a new registry to the
-        tree, use `sub.setNext(self, self.base)` instead!
-        """
-
-    def removeSub(sub):
-        """Remove a sub-registry to the node.
-
-        Important: This method should *not* be used manually. It is
-        automatically called by `setNext()`. To remove a registry from the
-        tree, use `sub.setNext(None)` instead!
-        """
-
-    def setNext(next, base=None):
-        """Set the next/parent registry in the tree.
-
-        This method should ensure that all relevant registies are updated
-        correctly as well.
-        """
-
-
-class IRegistrationManager(IContainerNamesContainer):
-    """Manage Registrations"""
-    contains(IRegistration)
-
-    def addRegistration(registration):
-        """Add a registration to the manager.
-
-        The function will automatically choose a name as which the
-        registration will be known. The name of the registration inside this
-        manager is returned.
-        """
-
-
-class IRegistrationManagerContained(IContained):
-    """Objects that can be contained by the registration manager should
-    implement this interface."""
-    containers(IRegistrationManager)
-
-
-class IRegisterableContainer(IContainer):
-    """Containers with registration managers
-
-    These are site-management folders of one sort or another.
-
-    The container allows clients to access the registration manager
-    without knowing it's name.
-
-    The registration manager container *also* supports local-module
-    lookup.
-    """
-
-    registrationManager = Field(
-        title=_("Registration Manager"),
-        description=_("The registration manager keeps track of all component "
-                    "registrations."))
-
-
-class IRegisterable(IContained):
-    """Mark a component as registerable.
-
-    All registerable components need to implement this interface. 
-    """
-    containers(IRegisterableContainer)
-
-
-class IRegisterableContainerContaining(IContainer):
-    """A container that can only contain `IRegisterable`s and
-    `IRegisterableContainer`s.
-
-    This interface was designed to be always used together with the
-    `IRegisterableContainer`.
-    """
-    contains(IRegisterable, IRegisterableContainer)
-    
-
-class IRegistered(Interface, bbb.interfaces.IBBBRegistered):
-    """An object that can track down its registrations.
-
-    The object need not implement this functionality itself, but must at
-    least support doing so via an adapter.
-    """
-
-    def registrations():
-        """Return a sequence of registration objects for this object."""

Modified: Zope3/branches/jim-adapter/src/zope/app/component/tests/test_site.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/tests/test_site.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/component/tests/test_site.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -19,6 +19,7 @@
 import unittest
 
 import zope.interface
+import zope.interface.verify
 from zope.testing import doctest
 
 from zope.app.testing import setup

Added: Zope3/branches/jim-adapter/src/zope/app/testing/back35.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/testing/back35.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/testing/back35.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Features that will be deprecated in Zope 3.5
+
+$Id$
+"""
+
+from zope.app import zapi
+import zope.interface
+from zope.component.service import IService
+from zope.app.site.interfaces import ISimpleService
+from zope.app.component.site import UtilityRegistration
+from zope.app.component.back35 import ActiveStatus
+
+def addService(servicemanager, name, service, suffix=''):
+    """Add a service to a service manager
+
+    This utility is useful for tests that need to set up services.
+    """
+    # Most local services implement ISimpleService in ZCML; therefore make
+    # sure we got it here as well.
+    zope.interface.directlyProvides(service, ISimpleService)
+
+    default = zapi.traverse(servicemanager, 'default')
+    default[name+suffix] = service
+    registration = UtilityRegistration(name, IService, service, default)
+    key = default.registrationManager.addRegistration(registration)
+    zapi.traverse(default.registrationManager, key).status = ActiveStatus
+    return default[name+suffix]


Property changes on: Zope3/branches/jim-adapter/src/zope/app/testing/back35.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/branches/jim-adapter/src/zope/app/testing/setup.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/testing/setup.py	2006-03-12 21:46:54 UTC (rev 65931)
+++ Zope3/branches/jim-adapter/src/zope/app/testing/setup.py	2006-03-12 21:46:56 UTC (rev 65932)
@@ -21,45 +21,14 @@
 from zope.app.testing import ztapi
 from zope.interface import classImplements
 
+import zope.deferredimport
 
-#############################################################################
-# BBB: Goes away in 3.3
+zope.deferredimport.deprecatedFrom(
+    "Goes away in Zope 3.5",
+    "zope.app.testing.back35",
+    "addService",
+    )
 
-import zope.deprecation
-
-zope.deprecation.__show__.off()
-from zope.component.bbb.service import IService
-from zope.app.site.interfaces import ISimpleService
-zope.deprecation.__show__.on()
-
-from zope.app.component.site import UtilityRegistration
-
-def addService(servicemanager, name, service, suffix=''):
-    """Add a service to a service manager
-
-    This utility is useful for tests that need to set up services.
-    """
-    # Most local services implement ISimpleService in ZCML; therefore make
-    # sure we got it here as well.
-    zope.interface.directlyProvides(service, ISimpleService)
-
-    default = zapi.traverse(servicemanager, 'default')
-    default[name+suffix] = service
-    registration = UtilityRegistration(name, IService, service, default)
-    key = default.registrationManager.addRegistration(registration)
-    zapi.traverse(default.registrationManager, key).status = ActiveStatus
-    return default[name+suffix]
-
-def createServiceManager(folder, setsite=False):
-    return createSiteManager(folder, setsite)
-
-zope.deprecation.deprecated(
-    'createServiceManager',
-    '`ServiceManager`s became `SiteManager`s. Use `createSiteManager` '
-    'instead. Gone in Zope 3.3.')
-
-#############################################################################
-
 #------------------------------------------------------------------------
 # Annotations
 from zope.app.annotation.attribute import AttributeAnnotations



More information about the Zope3-Checkins mailing list