[Zope3-checkins] SVN: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/ Addressed issue 469 by requiring the permission attribute.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Nov 16 17:05:04 EST 2005


Log message for revision 40183:
  Addressed issue 469 by requiring the permission attribute.
  

Changed:
  U   Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/metadirectives.py
  U   Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/test_directives.py
  U   Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml
  U   Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml
  A   Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml

-=-
Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/metadirectives.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/metadirectives.py	2005-11-16 22:01:20 UTC (rev 40182)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/metadirectives.py	2005-11-16 22:05:03 UTC (rev 40183)
@@ -23,7 +23,7 @@
 
 class IViewDirective(zope.interface.Interface):
     """View Directive for XML-RPC methods."""
-    
+
     for_ = zope.configuration.fields.GlobalObject(
         title=u"Published Object Type",
         description=u"""The types of objects to be published via XML-RPC
@@ -68,12 +68,12 @@
         If no permission is given, then permissions should be declared
         for the view using other means, such as the class directive.
         """,
-        required=False, )
+        required=True)
 
     name = zope.schema.TextLine(
         title=u"The name of the view.",
         description=u"""
-        
+
         If a name is given, then rpc methods are accessed by
         traversing the name and then accessing the methods.  In this
         case, the class should implement

Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/test_directives.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/test_directives.py	2005-11-16 22:01:20 UTC (rev 40182)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/test_directives.py	2005-11-16 22:05:03 UTC (rev 40183)
@@ -75,10 +75,14 @@
         self.assertEqual(v.index(), 'V1 here')
         self.assertEqual(v.action(), 'done')
 
-    def testIncompleteProtectedViewNoPermission(self):
+    def testIncompleteProtectedView(self):
         self.assertRaises(ConfigurationError, xmlconfig.file,
                           "xmlrpc_error.zcml", xmlrpc.tests)
 
+    def testNoPermission(self):
+        self.assertRaises(ConfigurationError, xmlconfig.file,
+                          "xmlrpc_noperm.zcml", xmlrpc.tests)
+
     def test_no_name(self):
         xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
         v = zapi.getMultiAdapter((ob, request), name='index')
@@ -86,9 +90,7 @@
         v = zapi.getMultiAdapter((ob, request), name='action')
         self.assertEqual(v(), 'done')
 
-        
 
-
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(DirectivesTest),

Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml	2005-11-16 22:01:20 UTC (rev 40182)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml	2005-11-16 22:05:03 UTC (rev 40183)
@@ -4,29 +4,30 @@
 
   <include package="zope.app.publisher.xmlrpc" file="meta.zcml"/>
   <include package="zope.app.security" file="meta.zcml"/>
- 
-  <xmlrpc:view 
+
+  <xmlrpc:view
       name="test"
       class="zope.app.component.tests.views.V1"
-      for="zope.app.component.tests.views.IC" 
+      for="zope.app.component.tests.views.IC"
+      permission="zope.Public"
       />
 
-  <xmlrpc:view 
+  <xmlrpc:view
       name="test2"
       class="zope.app.component.tests.views.V1"
       for="zope.app.component.tests.views.IC"
       permission="zope.Public"
-      interface="zope.app.component.tests.views.IV" 
+      interface="zope.app.component.tests.views.IV"
       />
 
-  <xmlrpc:view 
+  <xmlrpc:view
       name="test3"
       class="zope.app.component.tests.views.V1"
       for="zope.app.component.tests.views.IC"
       permission="zope.Public"
       methods="action" />
 
-  <xmlrpc:view 
+  <xmlrpc:view
       name="test4"
       class="zope.app.component.tests.views.V1"
       for="zope.app.component.tests.views.IC"
@@ -34,7 +35,7 @@
       methods="action"
       interface="zope.app.component.tests.views.IV" />
 
-  <xmlrpc:view 
+  <xmlrpc:view
       name="test5"
       class="zope.app.component.tests.views.V1"
       for="zope.app.component.tests.views.IC"
@@ -42,12 +43,13 @@
       methods="action index"
       interface="zope.app.component.tests.views.IV" />
 
- 
-  <xmlrpc:view 
+
+  <xmlrpc:view
       class="zope.app.component.tests.views.V1"
-      for="zope.app.component.tests.views.IC" 
+      for="zope.app.component.tests.views.IC"
       interface="zope.app.component.tests.views.IV"
       methods="action"
+      permission="zope.Public"
       />
 
 </configure>

Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml	2005-11-16 22:01:20 UTC (rev 40182)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml	2005-11-16 22:05:03 UTC (rev 40183)
@@ -3,11 +3,12 @@
            i18n_domain="zope">
 
   <include package="zope.app.publisher.xmlrpc" file="meta.zcml"/>
- 
-  <xmlrpc:view 
+
+  <xmlrpc:view
         name="test"
         factory="zope.component.tests.views.V1"
         for="zope.component.tests.views.IC"
-        methods="action index" />
+        methods="action index"
+        permission="zope.Public" />
 
 </configure>

Copied: Zope3/branches/Zope-3.1/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml (from rev 40181, Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml)



More information about the Zope3-Checkins mailing list