[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture - component-meta.zcml:1.1.2.2 component.zcml:1.1.2.3 metaConfigure.py:1.1.2.3

Jim Fulton jim@zope.com
Mon, 3 Jun 2002 13:15:44 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv12372/lib/python/Zope/App/ComponentArchitecture

Modified Files:
      Tag: Zope3InWonderland-branch
	component-meta.zcml component.zcml metaConfigure.py 
Log Message:
- Attribute renaming.

  In directives that define things, renamed thing_id to id. For
  example:

    <permission permission_id='xxx' ...

  became:

    <permission id='xxx' ...

  In directives that used things defined in this way, removed the id
  suffix. For example:

     <view permission_id='xxx' ...

  became:

     <view permission='xxx' ...

- Changed the way that exceptions from configuration files are
  reported. Went back to normal Python tracebacks followed by
  "configuration tracebacks". The configuration tracebacks look
  somewhat similar to Python tracebacks, with file location
  information. The most specific configuration file location is at the
  end of the traceback, followed by the original error type and
  value. 

- Added a testxmlconfig function to the xmlconfig module to support
  unit testing. This function suppresses usual configuration error
  generation so that the original error is raised. This is needed so
  that unit tests can detect that proper low-level errors are raised. 

Note that everyone will need to edit their principals.zcml files to
reflect these changes!



=== Zope3/lib/python/Zope/App/ComponentArchitecture/component-meta.zcml 1.1.2.1 => 1.1.2.2 ===
        handler="Zope.App.ComponentArchitecture.metaConfigure.utility" />
 
-    <directive name="factory" attributes="component, factory_id"
+    <directive name="factory" attributes="component, id"
        handler="Zope.App.ComponentArchitecture.metaConfigure.factory" />
 
     <directive 
        name="view" 
        attributes="component, type, name, for, layer,
-                   permission_id, allowed_interface, allowed_attributes"
+                   permission, allowed_interface, allowed_attributes"
        handler="Zope.App.ComponentArchitecture.metaConfigure.view" />
 
     <directive name="defaultView" 
@@ -24,7 +24,7 @@
     <directive 
        name="resource" 
        attributes="component, type, name, layer,
-                   permission_id, allowed_interface, allowed_attributes"
+                   permission, allowed_interface, allowed_attributes"
        handler="Zope.App.ComponentArchitecture.metaConfigure.resource" />
 
     <directive name="skin" attributes="name, type, layers" 


=== Zope3/lib/python/Zope/App/ComponentArchitecture/component.zcml 1.1.2.2 => 1.1.2.3 ===
              component='.GlobalUtilityService.utilityService' />
 <security:protectClass class=".GlobalUtilityService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".IUtilityService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="provideUtility"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <serviceType name='Adapters'
@@ -23,11 +23,11 @@
 <service name='Adapters'
              component='.GlobalAdapterService.adapterService' />
 <security:protectClass class=".GlobalAdapterService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".IAdapterService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="provideAdapter"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <serviceType name='Factories'
@@ -35,11 +35,11 @@
 <service name='Factories'
              component='.GlobalFactoryService.factoryService' />
 <security:protectClass class=".GlobalFactoryService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".IFactoryService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="provideFactory"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <serviceType name='Skins'
@@ -47,11 +47,11 @@
 <service name='Skins'
              component='.GlobalSkinService.skinService' />
 <security:protectClass class=".GlobalSkinService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".ISkinService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="defineSkin"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <serviceType name='Views' 
@@ -59,11 +59,11 @@
 <service name='Views'
          component='.GlobalViewService.viewService' />
 <security:protectClass class=".GlobalViewService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".IViewService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="provideView, setDefaultViewName"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <serviceType name='Resources'
@@ -71,11 +71,11 @@
 <service name='Resources'
              component='.GlobalResourceService.resourceService' />
 <security:protectClass class=".GlobalResourceService+"
-             permission_id="Zope.Public">
+             permission="Zope.Public">
     <security:protect interface=".IResourceService+"
-             permission_id="Zope.Public" />
+             permission="Zope.Public" />
     <security:protect names="provideResource"
-             permission_id="Zope.ManageServices" />
+             permission="Zope.ManageServices" />
 </security:protectClass>
 
 <hookable name=".getServiceManager" />


=== Zope3/lib/python/Zope/App/ComponentArchitecture/metaConfigure.py 1.1.2.2 => 1.1.2.3 ===
     method(*args, **kwargs)
 
-def adapter(_context, factory, provides, for_=None, permission_id=None):
+def adapter(_context, factory, provides, for_=None, permission=None):
     if for_ is not None: for_ = _context.resolve(for_)
     provides = _context.resolve(provides)
     factory = map(_context.resolve, factory.split())
 
-    if permission_id is not None:
-        if permission_id == 'Zope.Public':
-            permission_id = CheckerPublic
-        checker = InterfaceChecker(provides, permission_id)
+    if permission is not None:
+        if permission == 'Zope.Public':
+            permission = CheckerPublic
+        checker = InterfaceChecker(provides, permission)
         factory.append(lambda c: Proxy(c, checker))
 
     return [
@@ -56,14 +56,14 @@
             )
         ]
 
-def utility(_context, component, provides, permission_id=None):
+def utility(_context, component, provides, permission=None):
     provides = _context.resolve(provides)
     component = _context.resolve(component)
 
-    if permission_id is not None:
-        if permission_id == 'Zope.Public':
-            permission_id = CheckerPublic
-        checker = InterfaceChecker(provides, permission_id)
+    if permission is not None:
+        if permission == 'Zope.Public':
+            permission = CheckerPublic
+        checker = InterfaceChecker(provides, permission)
         component = Proxy(component, checker)
 
     return [
@@ -74,44 +74,44 @@
             )
         ]
 
-def factory(_context, component, factory_id=None):
-    if factory_id is None:
-        factory_id = component
+def factory(_context, component, id=None):
+    if id is None:
+        id = component
         
     component = _context.resolve(component)
 
     return [
         Action(
-            discriminator = ('factory', factory_id),
+            discriminator = ('factory', id),
             callable = handler,
-            args = ('Factories','provideFactory',factory_id, component),
+            args = ('Factories', 'provideFactory', id, component),
             )
         ]
 
-def _checker(_context, permission_id, allowed_interface, allowed_attributes):
+def _checker(_context, permission, allowed_interface, allowed_attributes):
     if (not allowed_attributes) and (not allowed_interface):
         allowed_attributes = "__call__"
 
-    if permission_id == 'Zope.Public':
-        permission_id = CheckerPublic
+    if permission == 'Zope.Public':
+        permission = CheckerPublic
 
     require={}
     for name in (allowed_attributes or '').split():
-        require[name] = permission_id
+        require[name] = permission
     if allowed_interface:
         for name in _context.resolve(allowed_interface).names(1):
-            require[name] = permission_id
+            require[name] = permission
 
     checker = Checker(require.get)
 
     return checker
 
 def resource(_context, factory, type, name, layer='',
-             permission_id=None,
+             permission=None,
              allowed_interface=None, allowed_attributes=None):
 
     if ((allowed_attributes or allowed_interface)
-        and (not permission_id)):
+        and (not permission)):
         raise ConfigurationError(
             "Must use name attribute with allowed_interface or "
             "allowed_attributes"
@@ -122,9 +122,9 @@
     factory = _context.resolve(factory)
 
 
-    if permission_id:
+    if permission:
 
-        checker = _checker(_context, permission_id,
+        checker = _checker(_context, permission,
                            allowed_interface, allowed_attributes)
 
         def proxyResource(request, factory=factory, checker=checker):
@@ -142,11 +142,11 @@
         ]
 
 def view(_context, factory, type, name, for_=None, layer='',
-         permission_id=None, allowed_interface=None, allowed_attributes=None):
+         permission=None, allowed_interface=None, allowed_attributes=None):
 
 
     if ((allowed_attributes or allowed_interface)
-        and (not permission_id)):
+        and (not permission)):
         raise ConfigurationError(
             "Must use name attribute with allowed_interface or "
             "allowed_attributes"
@@ -160,9 +160,9 @@
     if not factory:
         raise ConfigurationError("No view factory specified.")
 
-    if permission_id:
+    if permission:
 
-        checker = _checker(_context, permission_id,
+        checker = _checker(_context, permission,
                            allowed_interface, allowed_attributes)
 
         def proxyView(context, request, factory=factory[-1], checker=checker):