[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Publisher/Browser - browser-meta.zcml:1.1.2.3 browser.zcml:1.1.2.2 metaConfigure.py:1.1.2.3

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


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

Modified Files:
      Tag: Zope3InWonderland-branch
	browser-meta.zcml browser.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/Publisher/Browser/browser-meta.zcml 1.1.2.2 => 1.1.2.3 ===
        name="view" 
        attributes="factory name for layer template
-                   permission_id allowed_interface allowed_attributes"
+                   permission allowed_interface allowed_attributes"
        handler="Zope.App.Publisher.Browser.metaConfigure.view" >
        <subdirective name="page" 
-                     attributes="name attribute permission_id layer" 
+                     attributes="name attribute permission layer" 
        /> 
        <subdirective name="defaultPage" 
-                     attributes="name attribute permission_id" 
+                     attributes="name attribute permission" 
        /> 
     </directive>
 
     <directive 
        name="defaultView" 
        attributes="factory name for layer template
-                   permission_id allowed_interface allowed_attributes"
+                   permission allowed_interface allowed_attributes"
        handler="Zope.App.Publisher.Browser.metaConfigure.defaultView" />
 
     <directive
         name="resource"
         attributes="factory name layer
-                    permission_id allowed_interface allowed_attributes"
+                    permission allowed_interface allowed_attributes"
         handler="Zope.App.Publisher.Browser.metaConfigure.resource">
        <subdirective name="page" 
-                     attributes="name attribute permission_id layer" 
+                     attributes="name attribute permission layer" 
        /> 
     </directive>
 


=== Zope3/lib/python/Zope/App/Publisher/Browser/browser.zcml 1.1.2.1 => 1.1.2.2 ===
 
   <security:protectClass class=".BrowserRequest."
-                         permission_id="Zope.Public">
+                         permission="Zope.Public">
     <security:protect interface=".IBrowserApplicationRequest." />
     <security:protect 
        interface="Zope.ComponentArchitecture.IViewService.IViewRequest" />


=== Zope3/lib/python/Zope/App/Publisher/Browser/metaConfigure.py 1.1.2.2 => 1.1.2.3 ===
 
     def __init__(self, _context, factory, name=None, layer='',
-                 permission_id=None,
+                 permission=None,
                  allowed_interface=None, allowed_attributes=None):
 
         if ((allowed_attributes or allowed_interface)
-            and (not name or not permission_id)):
+            and (not name or not permission)):
             raise ConfigurationError(
                 "Must use name attribute with allowed_interface or "
                 "allowed_attributes"
@@ -57,7 +57,7 @@
         self.factory = self._factory(_context, factory)
         self.layer = layer
         self.name = name
-        self.permission_id = permission_id
+        self.permission = permission
         self.allowed_attributes = allowed_attributes
         self.allowed_interface = allowed_interface
         self.pages = 0
@@ -65,11 +65,11 @@
     def _factory(self, _context, factory):
         return _context.resolve(factory)
 
-    def page(self, _context, name, attribute, permission_id=None, layer=None):
+    def page(self, _context, name, attribute, permission=None, layer=None):
 
-        permission_id = permission_id or self.permission_id
+        permission = permission or self.permission
 
-        factory = self._pageFactory(self.factory, attribute, permission_id)
+        factory = self._pageFactory(self.factory, attribute, permission)
 
         self.pages += 1
 
@@ -91,16 +91,16 @@
         return ('Resources', 'provideResource',
                 name, self.type, factory, layer)
         
-    def _pageFactory(self, factory, attribute, permission_id):
-        if permission_id:
-            if permission_id == 'Zope.Public':
-                permission_id = CheckerPublic
+    def _pageFactory(self, factory, attribute, permission):
+        if permission:
+            if permission == 'Zope.Public':
+                permission = CheckerPublic
 
             def pageView(request,
                          factory=factory, attribute=attribute,
-                         permission_id=permission_id):
+                         permission=permission):
                 return Proxy(getattr(factory(request), attribute),
-                             NamesChecker(__call__ = permission_id))
+                             NamesChecker(__call__ = permission))
 
         else:
 
@@ -114,14 +114,14 @@
         if not self.name:
             return ()
 
-        permission_id = self.permission_id
+        permission = self.permission
         allowed_interface = self.allowed_interface
         allowed_attributes = self.allowed_attributes
         factory = self.factory
 
-        if permission_id:
-            if permission_id == 'Zope.Public':
-                permission_id = CheckerPublic
+        if permission:
+            if permission == 'Zope.Public':
+                permission = CheckerPublic
             
             if ((not allowed_attributes) and (allowed_interface is None)
                 and (not self.pages)):
@@ -129,10 +129,10 @@
 
             require={}
             for name in (allowed_attributes or '').split():
-                require[name] = permission_id
+                require[name] = permission
             if allowed_interface:
                 for name in allowed_interface.names(1):
-                    require[name] = permission_id
+                    require[name] = permission
 
             checker = Checker(require.get)
 
@@ -158,7 +158,7 @@
 
     def __init__(self, _context, factory=None, name=None, for_=None,
                  layer='',
-                 permission_id=None,
+                 permission=None,
                  allowed_interface=None, allowed_attributes=None,
                  template=None):
 
@@ -173,16 +173,16 @@
         self.for_ = for_
         
         resource.__init__(self, _context, factory, name, layer,
-                          permission_id, allowed_interface, allowed_attributes)
+                          permission, allowed_interface, allowed_attributes)
 
 
-    def page(self, _context, name, attribute, permission_id=None, layer=None):
+    def page(self, _context, name, attribute, permission=None, layer=None):
         if self.template:
             raise ConfigurationError(
                 "Can't use page or defaultPage subdirectives for simple "
                 "template views")
         return super(view, self).page(
-            _context, name, attribute, permission_id, layer)
+            _context, name, attribute, permission, layer)
 
     def _factory(self, _context, factory):
 
@@ -207,19 +207,19 @@
         return ('Views', 'provideView',
                 self.for_, name, self.type, factory, layer)
 
-    def _pageFactory(self, factory, attribute, permission_id):
+    def _pageFactory(self, factory, attribute, permission):
 
         factory = factory[:]        
         
-        if permission_id:
-            if permission_id == 'Zope.Public':
-                permission_id = CheckerPublic
+        if permission:
+            if permission == 'Zope.Public':
+                permission = CheckerPublic
 
             def pageView(context, request,
                          factory=factory[-1], attribute=attribute,
-                         permission_id=permission_id):
+                         permission=permission):
                 return Proxy(getattr(factory(context, request), attribute),
-                             NamesChecker(__call__ = permission_id))
+                             NamesChecker(__call__ = permission))
 
         else: