[Zope3-checkins] SVN: Zope3/trunk/ Restructure registration framework to use direct references rather than

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Dec 7 19:46:02 EST 2004


Log message for revision 28582:
  Restructure registration framework to use direct references rather than 
  paths.
  
  I still have to do the database generation code for this, but I do not 
  understand how they are supposed to work, so I have to ask Jim tomorrow. 
  So for now, you have to delete your Data.fs file.
  
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/doc/TODOLATER.txt
  U   Zope3/trunk/src/zope/app/appsetup/bootstrap.py
  U   Zope3/trunk/src/zope/app/i18n/translationdomain.py
  U   Zope3/trunk/src/zope/app/intid/ftests.py
  U   Zope3/trunk/src/zope/app/registration/browser/__init__.py
  U   Zope3/trunk/src/zope/app/registration/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/registration/fssync/adapter.py
  U   Zope3/trunk/src/zope/app/registration/interfaces.py
  U   Zope3/trunk/src/zope/app/registration/registration.py
  U   Zope3/trunk/src/zope/app/registration/tests/test_registrations.py
  U   Zope3/trunk/src/zope/app/schema/schema.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py
  U   Zope3/trunk/src/zope/app/schemacontent/content.py
  U   Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
  U   Zope3/trunk/src/zope/app/security/permission.py
  U   Zope3/trunk/src/zope/app/securitypolicy/role.py
  U   Zope3/trunk/src/zope/app/site/browser/__init__.py
  U   Zope3/trunk/src/zope/app/site/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/site/browser/tools.py
  U   Zope3/trunk/src/zope/app/site/service.py
  U   Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
  U   Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py
  U   Zope3/trunk/src/zope/app/tests/setup.py
  U   Zope3/trunk/src/zope/app/utility/browser/__init__.py
  U   Zope3/trunk/src/zope/app/utility/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/utility/browser/ftests.py
  U   Zope3/trunk/src/zope/app/utility/interfaces.py
  U   Zope3/trunk/src/zope/app/utility/tests.py
  U   Zope3/trunk/src/zope/app/utility/utility.py
  U   Zope3/trunk/src/zope/app/utility/vocabulary.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/doc/CHANGES.txt	2004-12-08 00:46:02 UTC (rev 28582)
@@ -158,6 +158,9 @@
           replaced with the 'IRegistrationActivatedEvent' and
           'IRegistrationDectivatedEvent', respectively.
 
+        + Restructured registration framework to use direct references rather
+          than paths.
+
       - Replaced NotFoundError uses with more specific and meaningful
         exceptions. Eventually, NotFoundError will be deprecated.
 

Modified: Zope3/trunk/doc/TODOLATER.txt
===================================================================
--- Zope3/trunk/doc/TODOLATER.txt	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/doc/TODOLATER.txt	2004-12-08 00:46:02 UTC (rev 28582)
@@ -32,9 +32,6 @@
 
   Only Schema Arithmetic is left from this proposal.
 
-- Restructure registration framework to use direct references rather
-  than paths.
-
 - Partial adapters
 
   http://dev.zope.org/Zope3/PartialAdapters

Modified: Zope3/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -130,7 +130,7 @@
     package = getServiceManagerDefault(root_folder)
     registration_manager = package.getRegistrationManager()
     registration =  ServiceRegistration(service_type,
-                                        name,
+                                        package[name],
                                         registration_manager)
     key = registration_manager.addRegistration(registration)
     registration = traverseName(registration_manager, key)
@@ -165,7 +165,7 @@
     """Configure a utility in the root folder."""
     package = getServiceManagerDefault(root_folder)
     registration_manager = package.getRegistrationManager()
-    registration = UtilityRegistration(name, interface, folder_name)
+    registration = UtilityRegistration(name, interface, package[folder_name])
     key = registration_manager.addRegistration(registration)
     registration.status = initial_status
 

Modified: Zope3/trunk/src/zope/app/i18n/translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/translationdomain.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/i18n/translationdomain.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -231,9 +231,7 @@
     set the domain of the TranslationDomain.
     """
     def activated(self):
-        domain = self.getComponent()
-        domain.domain = self.name
+        self.component.domain = self.name
 
     def deactivated(self):
-        domain = self.getComponent()
-        domain.domain = '<domain not activated>'
+        self.component.domain = '<domain not activated>'

Modified: Zope3/trunk/src/zope/app/intid/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/ftests.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/intid/ftests.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -53,7 +53,7 @@
 #        default = zapi.traverse(root, '/++etc++site/default')
 #        rm = default.getRegistrationManager()
 #        registration = UtilityRegistration(
-#            'cwm', IIntIds, self.basepath+'/intid')
+#            'cwm', IIntIds, zapi.traverse(self.basepath+'/intid'))
 #        pd_id = rm.addRegistration(registration)
 #        zapi.traverse(rm, pd_id).status = ActiveStatus
 

Modified: Zope3/trunk/src/zope/app/registration/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -15,11 +15,16 @@
 
 $Id$
 """
+import warnings
+
+from zope.interface import implements
+from zope.security.proxy import removeSecurityProxy
+
+from zope.app import zapi
 from zope.app.container.browser.adding import Adding
 from zope.app.container.interfaces import INameChooser
 from zope.app.form.browser.widget import SimpleInputWidget
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app import zapi
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.publisher.browser import BrowserView
 from zope.app.registration.interfaces import ActiveStatus
@@ -27,10 +32,6 @@
 from zope.app.registration.interfaces import IRegistration
 from zope.app.registration.interfaces import RegisteredStatus
 from zope.app.registration.interfaces import UnregisteredStatus
-from zope.app.traversing.api import getName, traverse
-from zope.component import getView, getServices
-from zope.interface import implements
-from zope.security.proxy import removeSecurityProxy
 
 class RegistrationView(BrowserView):
     """View for registerable objects that have at most one registration.
@@ -85,9 +86,9 @@
         useconfig = IRegistered(component)
         result = []
         for path in useconfig.usages():
-            config = traverse(component, path)
+            config = zapi.traverse(component, path)
             description = config.usageSummary()
-            url = getView(config, 'absolute_url', self.request)
+            url = zapi.getView(config, 'absolute_url', self.request)
             result.append({'path': path,
                            'url': url(),
                            'status': config.status,
@@ -130,8 +131,8 @@
 
         message = self.applyUpdates()
 
-        self.configBase = str(getView(getServices(), 'absolute_url',
-                                      self.request))
+        self.configBase = str(zapi.getView(zapi.getServices(), 'absolute_url',
+                                           self.request))
 
         registrations = self.context.info()
 
@@ -160,6 +161,8 @@
         self.message = message
 
 
+#############################################################################
+# BBB: Only for backward compatibility. 12/07/2004
 class ComponentPathWidget(SimpleInputWidget):
     """Widget for displaying component paths
 
@@ -170,6 +173,15 @@
     the context.
     """
 
+    def __init__(self, *args, **kw):
+        warnings.warn(
+            "Use of `ComponentPathWidget` deprecated, since the "
+            "registration code now uses the component directly instead "
+            "of using the component's path.",
+            DeprecationWarning, stacklevel=2,
+            )        
+        super(ComponentPathWidget, self).__init__(*agrs, **kw)
+
     def __call__(self):
         """See zope.app.browser.interfaces.form.IBrowserWidget"""
         # Render as a link to the component
@@ -180,15 +192,15 @@
             path = getattr(context, field.__name__)
             # The path may be relative; then interpret relative to ../..
             if not path.startswith("/"):
-                context = traverse(context, "../..")
-            component = traverse(context, path)
+                context = zapi.traverse(context, "../..")
+            component = zapi.traverse(context, path)
         else:
             # It must be a component that is about to be configured.
             component = context
             # Always use a relative path (just the component name)
-            path = getName(context)
+            path = zapi.name(context)
 
-        url = getView(component, 'absolute_url', self.request)
+        url = zapi.getView(component, 'absolute_url', self.request)
 
         return ('<a href="%s/@@SelectedManagementView.html">%s</a>'
                 % (url, path))
@@ -211,11 +223,62 @@
         else:
             # It must be a component that is about to be configured.
             # Always return a relative path (just the component name)
-            path = getName(context)
+            path = zapi.name(context)
 
         return path
+#############################################################################
 
 
+class ComponentWidget(SimpleInputWidget):
+    """Widget for displaying/entering component paths that point to components.
+
+    The widget doesn't actually allow editing. Rather it gets the
+    value by inspecting its field's context. If the context is an
+    IComponentRegistration, then it just gets its value from the
+    component using the field's name. Otherwise, it uses the path to
+    the context.
+    """
+
+    def __call__(self):
+        """See zope.app.browser.interfaces.form.IBrowserWidget"""
+        # Render as a link to the component
+        field = self.context
+        context = field.context
+        if IRegistration.providedBy(context):
+            # It's a registration object. Just get the corresponding attr
+            component = getattr(context, field.__name__)
+            path = zapi.getPath(component)
+        else:
+            # It must be a component that is about to be configured.
+            component = context
+            # Always use a relative path (just the component name)
+            path = zapi.name(context)
+
+        url = zapi.getView(component, 'absolute_url', self.request)
+
+        return ('<a href="%s/@@SelectedManagementView.html">%s</a>'
+                % (url, path))
+
+    def hidden(self):
+        """See zope.app.browser.interfaces.form.IBrowserWidget"""
+        return ''
+
+    def hasInput(self):
+        """See zope.app.form.interfaces.IWidget"""
+        return 1
+
+    def getInputValue(self):
+        """See zope.app.form.interfaces.IWidget"""
+        field = self.context
+        context = field.context
+        if IRegistration.providedBy(context):
+            # It's a registration object. Just get the corresponding attr
+            return getattr(context, field.getName())
+
+        # It must be a component that is about to be configured.
+        return context
+
+
 class AddComponentRegistration(BrowserView):
     """View for adding component registrations
 
@@ -255,7 +318,7 @@
     menu_id = "add_registration"
 
     def nextURL(self):
-        return str(getView(self.context, "absolute_url", self.request))
+        return str(zapi.getView(self.context, "absolute_url", self.request))
 
 
 class EditRegistration(BrowserView):
@@ -305,7 +368,7 @@
         """Render View for each directives."""
         result = []
         for name, configobj in self.context.items():
-            url = str(getView(configobj, 'absolute_url', self.request))
+            url = str(zapi.getView(configobj, 'absolute_url', self.request))
             active = configobj.status == ActiveStatus
             summary1 = getattr(configobj, "usageSummary", None)
             summary2 = getattr(configobj, "implementationSummary", None)

Modified: Zope3/trunk/src/zope/app/registration/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/browser/configure.zcml	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/browser/configure.zcml	2004-12-08 00:46:02 UTC (rev 28582)
@@ -11,6 +11,7 @@
                    "zope.app.form.browser.interfaces.IFormCollaborationView"
       permission="zope.ManageServices" />
 
+  <!-- BBB: Backward-compatibility: 12/07/2004 -->
   <zope:view
       for="zope.app.registration.interfaces.IComponentPath"
       type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -26,7 +27,25 @@
       factory=".ComponentPathWidget"
       permission="zope.Public"
       />
+  <!-- BBB: End of backward-compatibility block -->
 
+
+  <zope:view
+      for="zope.app.registration.interfaces.IComponent"
+      type="zope.publisher.interfaces.browser.IBrowserRequest"
+      provides="zope.app.form.interfaces.IInputWidget"
+      factory=".ComponentWidget"
+      permission="zope.Public"
+      />
+
+  <zope:view
+      for="zope.app.registration.interfaces.IComponent"
+      type="zope.publisher.interfaces.browser.IBrowserRequest"
+      provides="zope.app.form.interfaces.IDisplayWidget"
+      factory=".ComponentWidget"
+      permission="zope.Public"
+      />
+
 <!-- RegistrationManager -->
 
   <page

Modified: Zope3/trunk/src/zope/app/registration/fssync/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/adapter.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/fssync/adapter.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -40,7 +40,7 @@
 
         def UtilityRegistration():
             from zope.app.utility import UtilityRegistration
-            return UtilityRegistration("", None, "")
+            return UtilityRegistration("", None, None)
 
     The file representation of a registration object is an XML pickle
     for a modified version of the instance dict.  In this version of

Modified: Zope3/trunk/src/zope/app/registration/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/interfaces.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/interfaces.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -18,7 +18,7 @@
 import zope.component.interfaces
 from zope.interface import Interface, Attribute, implements
 from zope.schema import TextLine, Field, Choice
-from zope.schema.interfaces import ITextLine
+from zope.schema.interfaces import ITextLine, IField
 
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.annotation.interfaces import IAnnotatable
@@ -111,7 +111,8 @@
         this might include a template path and a dotted class name.
         """
 
-
+#############################################################################
+# BBB: Kept for backward-compatibility. 12/05/2004
 class IComponentPath(ITextLine):
     """A component path
 
@@ -126,33 +127,58 @@
     traversed to get an object.
     """
     implements(IComponentPath)
+#############################################################################
 
 
+class IComponent(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):
+    """A component path
+
+    Values of the field are absolute unicode path strings that can be
+    traversed to get an object.
+    """
+    implements(IComponent)
+
+
+
 class IComponentRegistration(IRegistration):
     """Registration object that uses a component path and a permission."""
 
+    permission = Choice(
+        title=_("The permission needed to use the component"),
+        vocabulary="Permissions",
+        required=False,
+        )
+
+    component = Component(
+        title=_("Registration Component"),
+        description=_("The component the registration is for."),
+        required=True)
+
+    #########################################################################
+    # BBB: Kept for backward-compatibility. 12/05/2004
     componentPath = ComponentPath(
         title=_("Component path"),
         description=_("The path to the component; this may be absolute, "
                       "or relative to the nearest site management folder"),
         required=True)
 
-    permission = Choice(
-        title=_("The permission needed to use the component"),
-        vocabulary="Permissions",
-        required=False,
-        )
-
+    
     def getComponent():
         """Return the component named in the registration.
 
         This is provided for backward compatibility; please use the
         `component` attribute instead.
         """
+    #########################################################################
 
-    component = Attribute(_("the component named in the registration"))
 
-
 class IRegistrationStack(Interface):
     """A stack of registrations for a set of parameters
 

Modified: Zope3/trunk/src/zope/app/registration/registration.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/registration.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/registration.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -308,7 +308,6 @@
         zope.event.notify(RegistrationActivatedEvent(registration))
         # BBB: Depraction warningl 12/05/2004
         if hasattr(registration, 'activated'):
-            #import pdb; pdb.set_trace()
             warnings.warn(
                 "activated() deprected. Subscribe to "
                 "IRegistrationActivatedEvent instead.",
@@ -624,6 +623,9 @@
         return ""
 
 
+# BBB: 12/05/2004
+NULL_COMPONENT = object()
+
 class ComponentRegistration(SimpleRegistration):
     """Component registration.
 
@@ -633,34 +635,47 @@
 
     implements(interfaces.IComponentRegistration)
 
-    def __init__(self, component_path, permission=None):
-        self.componentPath = component_path
+    def __init__(self, component, permission=None):
+        # BBB: 12/05/2004
+        if isinstance(component, (str, unicode)):
+            self.componentPath = component
+        else:
+            # We always want to set the plain component. Untrusted code will
+            # get back a proxied component anyways.
+            self.component = removeSecurityProxy(component)
         if permission == 'zope.Public':
             permission = CheckerPublic
         self.permission = permission
 
     def implementationSummary(self):
-        return self.componentPath
+        return zapi.getPath(self.component)
 
+    ###########################################################################
+    # BBB: Backward compatibility from 12/05/2004
     def getComponent(self):
-        service_manager = zapi.getServices(self)
+        warnings.warn(
+            "`getComponent()` is deprecated, since the component is now "
+            "available directly via `component`. Also, you should not use the "
+            "not use `componentPath` anymore, since it is deprecated.",
+            DeprecationWarning, stacklevel=2,
+            )
+        return self.__BBB_getComponent()
 
-        # The user of the registration object may not have permission
-        # to traverse to the component.  Yet they should be able to
-        # get it by calling getComponent() on a registration object
-        # for which they do have permission.  What they get will be
-        # wrapped in a security proxy of course.  Hence:
+    def __BBB_getComponent(self):
+        if self._component is NULL_COMPONENT:
+            return self.__BBB_old_getComponent(self._BBB_componentPath)
 
-        # We have to be clever here. We need to do an honest to
-        # god unrestricted traveral, which means we have to
-        # traverse from an unproxied object. But, it's not enough
-        # for the service manager to be unproxied, because the
-        # path is an absolute path. When absolute paths are
-        # traversed, the traverser finds the physical root and
-        # traverses from there, so we need to make sure the
-        # physical root isn't proxied.
+        # This condition should somehow make it in the final code, since it
+        # honors the permission.
+        if self.permission:
+            checker = InterfaceChecker(self.getInterface(), self.permission)
+            return Proxy(self._component, checker)
 
-        path = self.componentPath
+        return self._component
+
+    def __BBB_old_getComponent(self, path):
+        service_manager = zapi.getServices(self)
+        
         # Get the root and unproxy it
         if path.startswith("/"):
             # Absolute path
@@ -686,9 +701,38 @@
 
         return component
 
+    def __BBB_setComponent(self, component):
+        self._BBB_componentPath = None
+        self._component = component
+
+    component = property(__BBB_getComponent, __BBB_setComponent)
+    
+    def __BBB_getComponentPath(self):
+        warnings.warn(
+            "`componentPath` is deprecated. You can get to the component "
+            "directly by accessing `component`.",
+            DeprecationWarning, stacklevel=3,
+            )
+        if self._BBB_componentPath is not None:
+            return self._BBB_componentPath
+        return '/' + '/'.join(zapi.getPath(self.component))
+
+    def __BBB_setComponentPath(self, path):
+        warnings.warn(
+            "`componentPath` is deprecated. You can get to the component "
+            "directly by accessing `component`.",
+            DeprecationWarning, stacklevel=3,
+            )
+        self._component = NULL_COMPONENT
+        self._BBB_componentPath = path
+
+    componentPath = property(__BBB_getComponentPath, __BBB_setComponentPath)
+    ###########################################################################
+
+
 def ComponentRegistrationRemoveSubscriber(component_registration, event):
     """Receive notification of remove event."""
-    component = component_registration.getComponent()
+    component = component_registration.component
     dependents = IDependable(component)
     objectpath = zapi.getPath(component_registration)
     dependents.removeDependent(objectpath)
@@ -699,7 +743,7 @@
 
 def ComponentRegistrationAddSubscriber(component_registration, event):
     """Receive notification of add event."""
-    component = component_registration.getComponent()
+    component = component_registration.component
     dependents = IDependable(component)
     objectpath = zapi.getPath(component_registration)
     dependents.addDependent(objectpath)
@@ -711,13 +755,7 @@
 def RegisterableMoveSubscriber(registerable, event):
     """Updates componentPath for registrations on component rename."""
     if event.oldParent is not None and event.newParent is not None:
-        if event.oldParent is event.newParent:
-            registered = interfaces.IRegistered(registerable, None)
-            if registered is not None:
-                for reg in registered.registrations():
-                    if interfaces.IComponentRegistration.providedBy(reg):
-                        reg.componentPath = event.newName
-        else:
+        if event.oldParent is not event.newParent:
             raise DependencyError(
                 "Can't move a registered component from its container.")
 

Modified: Zope3/trunk/src/zope/app/registration/tests/test_registrations.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/tests/test_registrations.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/registration/tests/test_registrations.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.testing.doctestunit import DocTestSuite
 
@@ -81,6 +80,7 @@
 
     def __init__(self):
         self.status = UnregisteredStatus
+        self.component = self
 
     def getPath(self):
         return 'dummy!'
@@ -147,26 +147,22 @@
         PlacefulSetup.setUp(self, site=True)
         self.name = 'foo'
 
-    def test_getComponent(self):
+    def test_component(self):
         # set up a component
-        name, component = 'foo', object()
-        self.rootFolder[name] = component
+        component = object()
         # set up a registration
-        cfg = ComponentRegistration("/"+name)
-        cfg.__parent__ = self.rootFolder
+        cfg = ComponentRegistration(component)
         # check that getComponent finds the registration
-        self.assertEquals(cfg.getComponent(), component)
+        self.assertEquals(cfg.component, component)
 
     def test_getComponent_permission(self):
         # set up a component
-        name, component = 'foo', object()
-        self.rootFolder[name] = component
+        component = object()
         # set up a registration
-        cfg = ComponentRegistration("/"+name, 'zope.TopSecret')
+        cfg = ComponentRegistration(component, 'zope.TopSecret')
         cfg.getInterface = lambda: ITestComponent
-        cfg.__parent__ = self.rootFolder
-        # check that getComponent finds the registration
-        result = cfg.getComponent()
+        # Check that the component is proxied.
+        result = cfg.component
         self.assertEquals(result, component)
         self.failUnless(type(result) is Proxy)
 
@@ -226,15 +222,15 @@
 
     and create a registration for it:
 
-        >>> reg = ComponentRegistration("foo")
+        >>> reg = ComponentRegistration(component)
         >>> sm['default']['reg'] = reg
         >>> ztapi.provideAdapter(IRegisterable, IRegistered, Registered)
         >>> IRegistered(component).addUsage('reg')
 
     The registration is initially configured with the component path:
 
-        >>> reg.componentPath
-        'foo'
+        >>> reg.component is component
+        True
 
     The RegisterableMoveSubscriber subscriber is for IRegisterable and
     IObjectMovedEvent. When we invoke it with the appropriate 'rename' event
@@ -249,8 +245,8 @@
 
     the registration component path is updated accordingly:
 
-        >>> reg.componentPath
-        'bar'
+        >>> reg.component is component
+        True
 
     However, if we invoke RegisterableMoveSubscriber with a 'move' event (i.e.
     oldParent is different from newParent):
@@ -287,7 +283,7 @@
 
     and create a registration for it:
 
-        >>> reg = ComponentRegistration("foo")
+        >>> reg = ComponentRegistration(component)
         >>> sm['default']['reg'] = reg
         >>> ztapi.provideAdapter(IRegisterable, IRegistered, Registered)
         >>> IRegistered(component).addUsage('/++etc++site/default/reg')

Modified: Zope3/trunk/src/zope/app/schema/schema.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/schema.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/schema/schema.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -278,9 +278,7 @@
     """
 
     def activated(self):
-        schema = self.getComponent()
-        schema.setName(self.name)
+        self.component.setName(self.name)
 
     def deactivated(self):
-        schema = self.getComponent()
-        schema.setName('<schema not activated>')
+        self.component.setName('<schema not activated>')

Modified: Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -225,10 +225,10 @@
         utilities = getService(Utilities, self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
-        path = "/++etc++site/default/foo"
+        foo = default['foo']
 
         for name in ('', 'bob'):
-            registration = utility.UtilityRegistration(name, IInterface, path)
+            registration = utility.UtilityRegistration(name, IInterface, foo)
             self.assertEqual(utilities.queryRegistrationsFor(registration),
                              None)
             registery = utilities.createRegistrationsFor(registration)
@@ -246,11 +246,11 @@
         utilities = getService(Utilities, self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
-        path = "/++etc++site/default/foo"
+        foo = default['foo']
         cm = default.getRegistrationManager()
 
         for name in ('', 'bob'):
-            registration = utility.UtilityRegistration(name, IInterface, path)
+            registration = utility.UtilityRegistration(name, IInterface, foo)
             cname = cm.addRegistration(registration)
             registration = traverse(cm, cname)
 

Modified: Zope3/trunk/src/zope/app/schemacontent/content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/content.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/schemacontent/content.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -50,14 +50,10 @@
     """Content Component Registration"""
 
     def activated(self):
-        component = self.getComponent()
-        component = removeSecurityProxy(component)
-        component.name = self.name
+        self.component.name = self.name
 
     def deactivated(self):
-        component = self.getComponent()
-        component = removeSecurityProxy(component)
-        component.name = None
+        self.component.name = None
 
 
 class ContentComponentInstance(Persistent):

Modified: Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -62,7 +62,7 @@
         # Setup Definition Registration
         path = "%s/default/%s" % (zapi.getPath(mgr), 'TestDoc')
         reg = ContentComponentDefinitionRegistration(
-            'TestDoc', IContentComponentDefinition, path)
+            'TestDoc', IContentComponentDefinition, default['TestDoc'])
         key = default.getRegistrationManager().addRegistration(reg)
         self.reg = zapi.traverse(default.getRegistrationManager(), key)
         
@@ -71,12 +71,12 @@
 
     def test_activated(self):
         self.reg.activated()
-        self.assertEqual(self.reg.getComponent().name, 'TestDoc')
+        self.assertEqual(self.reg.component.name, 'TestDoc')
 
     def test_deactivated(self):
         self.test_activated()
         self.reg.deactivated()
-        self.assertEqual(self.reg.getComponent().name, None)
+        self.assertEqual(self.reg.component.name, None)
 
 
 class ContentComponentInstanceTests(unittest.TestCase):

Modified: Zope3/trunk/src/zope/app/security/permission.py
===================================================================
--- Zope3/trunk/src/zope/app/security/permission.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/security/permission.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -52,11 +52,8 @@
 
     >>> class Registration:
     ...     def __init__(self, obj, name):
-    ...         self.object = obj
+    ...         self.component = obj
     ...         self.name = name
-    ...
-    ...     def getComponent(self):
-    ...         return self.object
 
     >>> perm1 = LocalPermission('Permission 1', 'A first permission')
     >>> perm1.id
@@ -85,7 +82,7 @@
     >>> foo.id
     'no id'
     """
-    perm = event.object.getComponent()
+    perm = event.object.component
     if isinstance(perm, LocalPermission):
         perm.id = event.object.name
 
@@ -98,11 +95,8 @@
 
     >>> class Registration:
     ...     def __init__(self, obj, name):
-    ...         self.object = obj
+    ...         self.component = obj
     ...         self.name = name
-    ...
-    ...     def getComponent(self):
-    ...         return self.object
 
     >>> perm1 = LocalPermission('Permission 1', 'A first permission')
     >>> perm1.id = 'perm1'
@@ -130,7 +124,7 @@
     >>> foo.id
     'foo'
     """
-    perm = event.object.getComponent()
+    perm = event.object.component
     if isinstance(perm, LocalPermission):
         perm.id = NULL_ID
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/role.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/role.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/securitypolicy/role.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -55,11 +55,8 @@
 
     >>> class Registration:
     ...     def __init__(self, obj, name):
-    ...         self.object = obj
+    ...         self.component = obj
     ...         self.name = name
-    ...
-    ...     def getComponent(self):
-    ...         return self.object
 
     >>> role1 = LocalRole('Role 1', 'A first role')
     >>> role1.id
@@ -87,7 +84,7 @@
     >>> foo.id
     'no id'
     """
-    role = event.object.getComponent()
+    role = event.object.component
     if isinstance(role, LocalRole):
         role.id = event.object.name
 
@@ -100,11 +97,8 @@
 
     >>> class Registration:
     ...     def __init__(self, obj, name):
-    ...         self.object = obj
+    ...         self.component = obj
     ...         self.name = name
-    ...
-    ...     def getComponent(self):
-    ...         return self.object
 
     >>> role1 = LocalRole('Role 1', 'A first role')
     >>> role1.id = 'role1'
@@ -132,7 +126,7 @@
     >>> foo.id
     'foo'
     """
-    role = event.object.getComponent()
+    role = event.object.component
     if isinstance(role, LocalRole):
         role.id = NULL_ID
 

Modified: Zope3/trunk/src/zope/app/site/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -123,13 +123,12 @@
             if interface.providedBy(content):
                 implements.append(type_name)
 
-        path = zapi.name(content)
         rm = content.__parent__.getRegistrationManager()
         chooser = INameChooser(rm)
 
         # register an activated service registration
         for type_name in implements:
-            sc = ServiceRegistration(type_name, path, content)
+            sc = ServiceRegistration(type_name, content, content)
             name = chooser.chooseName(type_name, sc)
             rm[name] = sc
             sc.status = ActiveStatus
@@ -181,12 +180,11 @@
         return lst
 
     def action(self, name=[], active=[]):
-        path = zapi.name(self.context)
         rm = self.context.__parent__.getRegistrationManager()
         chooser = INameChooser(rm)
 
         for nm in name:
-            sc = ServiceRegistration(nm, path, self.context)
+            sc = ServiceRegistration(nm, self.context, self.context)
             name = chooser.chooseName(nm, sc)
             rm[name] = sc
             if nm in active:
@@ -274,7 +272,7 @@
             assert registry.active() is None # Phase error
             for info in registry.info():
                 conf = info['registration']
-                obj = conf.getComponent()
+                obj = conf.component
                 path = zapi.getPath(obj)
                 services[path] = obj
                 conf.status = UnregisteredStatus
@@ -344,7 +342,7 @@
         infos = [info for info in registry.info() if info['active']]
         if infos:
             configobj = infos[0]['registration']
-            component = configobj.getComponent()
+            component = configobj.component
             url = str(
                 zapi.getView(component, 'absolute_url', request))
         else:
@@ -383,7 +381,7 @@
         result = []
         for info in registry.info():
             configobj = info['registration']
-            component = configobj.getComponent()
+            component = configobj.component
             path = zapi.getPath(component)
             path = path.split("/")
             info['id'] = zapi.getPath(configobj)

Modified: Zope3/trunk/src/zope/app/site/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/configure.zcml	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/browser/configure.zcml	2004-12-08 00:46:02 UTC (rev 28582)
@@ -189,7 +189,7 @@
       menu="zmi_views"
       label="Edit Service Registration"
       permission="zope.ManageServices"
-      fields="name componentPath permission status" />
+      fields="name component permission status" />
 
   <page
       name="addRegistration.html"

Modified: Zope3/trunk/src/zope/app/site/browser/tools.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/tools.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/browser/tools.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -135,12 +135,12 @@
             # Delete registrations
             for info in reg.info():
                 conf = info['registration']
-                obj = conf.getComponent()
+                obj = conf.component
                 conf.status = UnregisteredStatus
                 reg_folder = zapi.getParent(conf)
                 name = zapi.name(conf)
                 del reg_folder[name]
-                if obj not in [c.getComponent()
+                if obj not in [c.component
                                for c in reg_folder.values()]:
                     del_objs.append(obj)
 
@@ -226,12 +226,12 @@
             # Delete registrations
             for info in reg.info():
                 conf = info['registration']
-                obj = conf.getComponent()
+                obj = conf.component
                 conf.status = UnregisteredStatus
                 reg_folder = zapi.getParent(conf)
                 name = zapi.name(conf)
                 del reg_folder[name]
-                if obj not in [c.getComponent()
+                if obj not in [c.component
                                for c in reg_folder.values()]:
                     del_objs.append(obj)
 
@@ -324,7 +324,7 @@
         # Add registration
         registration = UtilityRegistration(self.contentName,
                                            self._addFilterInterface,
-                                           zapi.getPath(util))
+                                           util)
         reg_view = AddRegistration(util, self.request)
         reg_view.add(registration)
 

Modified: Zope3/trunk/src/zope/app/site/service.py
===================================================================
--- Zope3/trunk/src/zope/app/site/service.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/service.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -149,7 +149,7 @@
         if registry:
             registration = registry.active()
             if registration is not None:
-                return registration.getComponent()
+                return registration.component
         return default
 
     def getServiceDefinitions(self):
@@ -289,14 +289,13 @@
 
     zope.interface.implements(IServiceRegistration)
 
-    def __init__(self, name, path, context=None):
-        ComponentRegistration.__init__(self, path, None)
+    def __init__(self, name, service, context=None):
+        super(ServiceRegistration, self).__init__(service, None)
         self.name = name
 
         if context is not None:
             # Check that the object implements stuff we need
             self.__parent__ = context
-            service = self.getComponent()
             if not ILocalService.providedBy(service):
                 raise TypeError(
                     "service %r doesn't implement ILocalService" %
@@ -313,12 +312,12 @@
 
 def handleActivated(event):
     if isinstance(event.object, ServiceRegistration):
-        service = event.object.getComponent()
+        service = event.object.component
         if IBindingAware.providedBy(service):
             service.bound(event.object.name)
 
 def handleDeactivated(event):
     if isinstance(event.object, ServiceRegistration):
-        service = event.object.getComponent()
+        service = event.object.component
         if IBindingAware.providedBy(service):
             service.unbound(event.object.name)

Modified: Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -48,9 +48,8 @@
 
         ts = TestService()
         default['test_service1'] = ts
-        registration = ServiceRegistration(
-            'test_service',
-            '/++etc++site/default/test_service1')
+        registration = ServiceRegistration('test_service',
+                                           default['test_service1'])
 
         rm = default.getRegistrationManager()
         name = rm.addRegistration(registration)
@@ -77,9 +76,8 @@
         default = traverse(sm, 'default')
         ts = TestService()
         default['test_service1'] = ts
-        registration = ServiceRegistration(
-            'test_service',
-            '/++etc++site/default/test_service1')
+        registration = ServiceRegistration('test_service',
+                                           default['test_service1'])
         rm = default.getRegistrationManager()
         name = rm.addRegistration(registration)
         traverse(rm, name).status = ActiveStatus
@@ -102,18 +100,16 @@
 
         ts1 = TestService()
         default['test_service1'] = ts1
-        registration = ServiceRegistration(
-            'test_service',
-            '/++etc++site/default/test_service1')
+        registration = ServiceRegistration('test_service',
+                                           default['test_service1'])
         rm = default.getRegistrationManager()
         name = rm.addRegistration(registration)
         traverse(rm, name).status = ActiveStatus
 
         ts2 = TestService()
         default['test_service2'] = ts2
-        registration = ServiceRegistration(
-            'test_service',
-            '/++etc++site/default/test_service2')
+        registration = ServiceRegistration('test_service',
+                                           default['test_service2'])
         name = rm.addRegistration(registration)
         traverse(rm, name).status = RegisteredStatus
 

Modified: Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -86,7 +86,7 @@
         default['c'] = TestService()
 
         registration = ServiceRegistration(
-            'test_service', '/++etc++site/default/c')
+            'test_service', default['c'])
 
         self.__c = traverse(default, 'c')
         self.__cm = default.getRegistrationManager()
@@ -117,7 +117,7 @@
     # zope.app.services.tests.testregistrations, but in a different way
 
     def test_getComponent(self):
-        self.assertEqual(self.__config.getComponent(), self.__c)
+        self.assertEqual(self.__config.component, self.__c)
 
     def test_not_a_local_service(self):
         defineService('test_service_2', ITestService)
@@ -127,7 +127,7 @@
             TypeError,
             ServiceRegistration,
             'test_service',
-            '/++etc++site/default/c2',
+            self.__default['c2'],
             self.__default
             )
 

Modified: Zope3/trunk/src/zope/app/tests/setup.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/setup.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/tests/setup.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -175,11 +175,10 @@
 
     default = zapi.traverse(servicemanager, 'default')
     default[name+suffix] = service
-    path = "%s/default/%s" % (zapi.getPath(servicemanager), name+suffix)
-    registration = ServiceRegistration(name, path, default)
+    registration = ServiceRegistration(name, service, default)
     key = default.getRegistrationManager().addRegistration(registration)
     zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
-    return zapi.traverse(servicemanager, path)
+    return default[name+suffix]
 
 from zope.app.utility import UtilityRegistration
 
@@ -192,11 +191,10 @@
     folder_name = (name or (iface.__name__ + 'Utility')) + suffix
     default = zapi.traverse(servicemanager, 'default')
     default[folder_name] = utility
-    path = "%s/default/%s" % (zapi.getPath(servicemanager), folder_name)
-    registration = UtilityRegistration(name, iface, path)
+    registration = UtilityRegistration(name, iface, default[folder_name])
     key = default.getRegistrationManager().addRegistration(registration)
     zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
-    return zapi.traverse(servicemanager, path)
+    return default[folder_name]
 
 def createStandardServices(folder):
     '''Create a bunch of standard placeful services

Modified: Zope3/trunk/src/zope/app/utility/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/browser/__init__.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/browser/__init__.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -128,7 +128,7 @@
             first = True
             for info in registry.info():
                 conf = info['registration']
-                obj = conf.getComponent()
+                obj = conf.component
                 done.append(conf.usageSummary())
                 path = zapi.getPath(obj)
                 services[path] = obj

Modified: Zope3/trunk/src/zope/app/utility/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/utility/browser/configure.zcml	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/browser/configure.zcml	2004-12-08 00:46:02 UTC (rev 28582)
@@ -67,8 +67,8 @@
       class=".AddRegistration"
       permission="zope.ManageServices"
       content_factory="zope.app.utility.UtilityRegistration"
-      arguments="name interface componentPath"
-      fields="name interface componentPath permission">
+      arguments="name interface component"
+      fields="name interface component permission">
       
       <widget 
           field="name" 
@@ -88,7 +88,7 @@
       name="index.html"
       schema="zope.app.utility.interfaces.IUtilityRegistration"
       permission="zope.ManageServices"
-      fields="name interface componentPath permission status" />
+      fields="name interface component permission status" />
 
  <menuItems
     menu="zmi_actions"

Modified: Zope3/trunk/src/zope/app/utility/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/browser/ftests.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/browser/ftests.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -36,7 +36,7 @@
         reg = zope.app.securitypolicy.role.RoleRegistration(
             "my-role-registration",
             zope.app.securitypolicy.interfaces.IRole,
-            "my-role")
+            default["my-role"])
         rm = default.getRegistrationManager()
         rm.addRegistration(reg)
         reg.status = "Active"

Modified: Zope3/trunk/src/zope/app/utility/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/interfaces.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/interfaces.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -32,9 +32,8 @@
 class IUtilityRegistration(IComponentRegistration):
     """Utility registration object.
 
-    This is keyed off name (which may be empty) and interface.  It
-    overrides componentPath (to make it readonly); it also inherits a
-    getComponent() method.
+    This is keyed off name (which may be empty) and interface. It inherits the
+    `component` property.
     """
 
     name = TextLine(
@@ -52,12 +51,6 @@
         required=True,
         )
 
-    componentPath = ComponentPath(
-        title=_("Component path"),
-        description=_("The physical path to the component"),
-        required=True,
-        readonly=True,
-        )
 
 class ILocalUtility(IRegisterable):
     """Local utility marker.

Modified: Zope3/trunk/src/zope/app/utility/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/tests.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/tests.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -169,10 +169,10 @@
         utilities = getService("Utilities", self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
-        path = "/++etc++site/default/foo"
+        foo = default['foo']
 
         for name in ('', 'bob'):
-            registration = utility.UtilityRegistration(name, IFoo, path)
+            registration = utility.UtilityRegistration(name, IFoo, foo)
             self.assertEqual(utilities.queryRegistrationsFor(registration),
                              None)
             registery = utilities.createRegistrationsFor(registration)
@@ -196,11 +196,11 @@
 
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
-        path = "/++etc++site/default/foo"
+        foo = default['foo']
         cm = default.getRegistrationManager()
 
         for name in ('', 'bob'):
-            registration = utility.UtilityRegistration(name, IFoo, path)
+            registration = utility.UtilityRegistration(name, IFoo, foo)
             cname = cm.addRegistration(registration)
             registration = traverse(cm, cname)
 

Modified: Zope3/trunk/src/zope/app/utility/utility.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/utility.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/utility.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -89,6 +89,7 @@
     This registration configures persistent components in packages to
     be utilities.
     """
+    zope.interface.implements(IUtilityRegistration)
 
     serviceType = zapi.servicenames.Utilities
 
@@ -98,28 +99,22 @@
     required = zope.interface.adapter.Null
     with = ()
     provided = property(lambda self: self.interface)
-    factory = property(lambda self: self.getComponent())
+    factory = property(lambda self: self.component)
     #
     ############################################################
 
-    zope.interface.implements(IUtilityRegistration)
-
-
-    component = property(lambda self: self.getComponent())
-
-    def __init__(self, name, interface, component_path, permission=None):
-        ComponentRegistration.__init__(self, component_path, permission)
+    def __init__(self, name, interface, component, permission=None):
+        super(UtilityRegistration, self).__init__(component, permission)
         self.name = name
         self.interface = interface
 
     def usageSummary(self):
         # Override IRegistration.usageSummary()
-        component = self.getComponent()
         s = self.getInterface().getName()
         if self.name:
             s += " registered as '%s'" % self.name
-        s += ", implemented by %s" %component.__class__.__name__
-        s += " '%s'"%self.componentPath
+        s += ", implemented by %s" %self.component.__class__.__name__
+        s += " '%s'"%zapi.name(self.component)
         return s
 
     def getInterface(self):

Modified: Zope3/trunk/src/zope/app/utility/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -220,7 +220,7 @@
 
     def __init__(self, context):
         if IUtilityRegistration.providedBy(context):
-            context = context.getComponent()
+            context = context.component
         super(UtilityComponentInterfacesVocabulary, self).__init__(
             context)
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -61,7 +61,8 @@
         default = zapi.traverse(root, '/++etc++site/default')
         rm = default.getRegistrationManager()
         registration = UtilityRegistration(
-            'cwm', IContentWorkflowsManager, self.basepath+'/mgr')
+            'cwm', IContentWorkflowsManager,
+            zapi.traverse(root, self.basepath+'/mgr'))
         pd_id = rm.addRegistration(registration)
         zapi.traverse(rm, pd_id).status = ActiveStatus
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2004-12-07 22:54:00 UTC (rev 28581)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2004-12-08 00:46:02 UTC (rev 28582)
@@ -103,7 +103,7 @@
 
         name = self.cm.addRegistration(
             UtilityRegistration('definition1', IProcessDefinition,
-                                '/++etc++site/default/pd1'))
+                                self.default['pd1']))
         zapi.traverse(self.default.getRegistrationManager(),
                       name).status = ActiveStatus
 
@@ -215,7 +215,7 @@
 
         n = self.cm.addRegistration(
             UtilityRegistration('definition1', IProcessDefinition,
-                                '/++etc++site/default/pd1'))
+                                self.default['pd1']))
         zapi.traverse(self.default.getRegistrationManager(), n
                       ).status = ActiveStatus
 
@@ -302,7 +302,7 @@
 
         k = self.cm.addRegistration(
             UtilityRegistration('definition1', IProcessDefinition,
-                                '/++etc++site/default/pd1'))
+                                self.default['pd1']))
         zapi.traverse(self.default.getRegistrationManager(),
                       k).status = ActiveStatus
 
@@ -389,7 +389,7 @@
 
         k = self.cm.addRegistration(
             UtilityRegistration('definition1', IProcessDefinition,
-                                '/++etc++site/default/pd1'))
+                                self.default['pd1']))
         zapi.traverse(self.default.getRegistrationManager(),
                       k).status = ActiveStatus
 



More information about the Zope3-Checkins mailing list