[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration/tests - Directives.py:1.1.2.4 testDirectivesXML.py:1.1.2.4 testMeta.py:1.1.2.7 testMultipleXML.py:1.1.2.3 testXML.py:1.1.2.8

Steve Alexander steve@cat-box.net
Sun, 10 Mar 2002 19:10:56 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Configuration/tests
In directory cvs.zope.org:/tmp/cvs-serv10945/lib/python/Zope/Configuration/tests

Modified Files:
      Tag: Zope-3x-branch
	Directives.py testDirectivesXML.py testMeta.py 
	testMultipleXML.py testXML.py 
Log Message:
Changed zcml security syntax to remove the "method=" attribute, and allow
only the "methods=" attribute.


=== Zope3/lib/python/Zope/Configuration/tests/Directives.py 1.1.2.3 => 1.1.2.4 ===
     __implements__ = INonEmptyDirective
 
-    def __init__(self, name, permission=None, methods=None, method=None):
+    def __init__(self, name, permission=None, methods=None):
         self._name=name
         self._permission=permission
         self._methods=methods
-        self._method=method
         self._children=[]
 
     def __call__(self):
         if not self._children:
-            p = self._name, self._permission, self._method, self._methods
-            d = self._name, self._method, self._methods
+            p = self._name, self._permission, self._methods
+            d = self._name, self._methods
             return [(d, protections.append, (p,))]
         else:
             return ()
             
-    def protect(self, permission=None, method=None, methods=None):
+    def protect(self, permission=None, methods=None):
         if permission is None: permission=self._permission
         if permission is None: raise 'no perm'
-        p=self._name, permission, method, methods
-        d=self._name, method, methods
+        p=self._name, permission, methods
+        d=self._name, methods
         self._children.append(p)
         return [(d, protections.append, (p,))]
 


=== Zope3/lib/python/Zope/Configuration/tests/testDirectivesXML.py 1.1.2.3 => 1.1.2.4 ===
                           ''' % ns,
             '''<test:protectClass
-              name=".Contact" permission="splat" method="update"
+              name=".Contact" permission="splat" methods="update"
               />'''
             )))
 
-        self.assertEquals(protections, [(".Contact", "splat", 'update', None)])
+        self.assertEquals(protections, [(".Contact", "splat", 'update')])
         
     def testComplexDirective(self):
         xmlconfig(StringIO(
@@ -62,14 +62,14 @@
                    </directive>
                </directives>''' % ns,
             '''<test:protectClass name=".Contact">
-                <test:protect permission="edit" method='update' />
+                <test:protect permission="edit" methods='update' />
                 <test:protect permission="view" methods='name, email' />
               </test:protectClass>'''
             )))
 
         self.assertEquals(protections, [
-            (".Contact", "edit", 'update', None),
-            (".Contact", "view", None, 'name, email'),
+            (".Contact", "edit", 'update'),
+            (".Contact", "view", 'name, email'),
             ])
         
     def testBadNoPrefixComplexDirective(self):
@@ -87,7 +87,7 @@
                </directives>''' % ns,
 
             '''<test:protectClass name=".Contact">
-              <test:protect permission="edit" method='update' />
+              <test:protect permission="edit" methods='update' />
               <protect permission="view" methods='name, email' />
               </test:protectClass>'''
             )))
@@ -106,7 +106,7 @@
                </directives>''' % ns,
 
                 '''<test:protectClass name=".Contact">
-                <test2:protect permission="edit" method='update' />
+                <test2:protect permission="edit" methods='update' />
                 </test:protectClass>'''
                 )))
         except ZopeXMLConfigurationError, v:


=== Zope3/lib/python/Zope/Configuration/tests/testMeta.py 1.1.2.6 => 1.1.2.7 ===
 
         subs=begin(None, (ns, 'protectClass'),
-                   name=".Contact", permission="splat", method='update')
+                   name=".Contact", permission="splat", methods='update')
 
         (des, callable, args, kw), = end(subs)
-        self.assertEqual(des, ('.Contact', 'update', None))
+        self.assertEqual(des, ('.Contact', 'update'))
         callable(*args)
 
-        self.assertEquals(protections, [(".Contact", "splat", 'update', None)])
+        self.assertEquals(protections, [(".Contact", "splat", 'update')])
         
     def testComplexDirective(self):
         from Zope.Configuration.meta \
@@ -58,22 +58,22 @@
         subs = begin(None, (ns, 'protectClass'), name=".Contact")
 
         actions = end(sub(subs, (ns, 'protect'),
-                          permission='edit', method='update'))
+                          permission='edit', methods='update'))
         (des, callable, args, kw), = actions
-        self.assertEqual(des, ('.Contact', 'update', None))
+        self.assertEqual(des, ('.Contact', 'update'))
         callable(*args)
 
         actions = end(sub(subs, (ns, 'protect'),
                           permission='view', methods='name, email'))
         (des, callable, args, kw), = actions
-        self.assertEqual(des, ('.Contact', None, 'name, email'))
+        self.assertEqual(des, ('.Contact', 'name, email'))
         callable(*args)
 
         self.assertEqual(tuple(end(subs)), ())
 
         self.assertEquals(protections, [
-            (".Contact", "edit", 'update', None),
-            (".Contact", "view", None, 'name, email'),
+            (".Contact", "edit", 'update'),
+            (".Contact", "view", 'name, email'),
             ])
 
 def test_suite():


=== Zope3/lib/python/Zope/Configuration/tests/testMultipleXML.py 1.1.2.2 => 1.1.2.3 ===
             '''
             <test:protectClass
-            name=".Contact" permission="splat" method="update"
+            name=".Contact" permission="splat" methods="update"
             />
             <test:protectClass
-            name=".Contact" permission="splat" method="update2"
+            name=".Contact" permission="splat" methods="update2"
             />            
             '''), 'f2')
 
@@ -48,7 +48,7 @@
             </directive>''' % (ns, ns),
             '''
             <test:protectClass
-            name=".Contact" permission="splat" method="update"
+            name=".Contact" permission="splat" methods="update"
             />
             <include file="%s"/>
             ''' % f2), 'f1')
@@ -56,24 +56,24 @@
         XMLConfig(str(f1))()
         
         self.assertEquals(protections, [
-            (".Contact", "splat", 'update', None),
-            (".Contact", "splat", 'update2', None),
+            (".Contact", "splat", 'update'),
+            (".Contact", "splat", 'update2'),
             ])
         
     def testConflicting(self):
         f2=tfile(template % ('',
             '''
             <test:protectClass
-            name=".Contact" permission="splat" method="update"
+            name=".Contact" permission="splat" methods="update"
             />
             <test:protectClass
-            name=".Contact" permission="splat" method="update2"
+            name=".Contact" permission="splat" methods="update2"
             />            
             '''), 'f2')
         f3=tfile(template % ('',
             '''
             <test:protectClass
-            name=".Contact" permission="splat" method="update2"
+            name=".Contact" permission="splat" methods="update2"
             />            
             '''), 'f3')
 
@@ -84,7 +84,7 @@
             </directive>''' % (ns, ns),
             '''
             <test:protectClass
-            name=".Contact" permission="splat" method="update"
+            name=".Contact" permission="splat" methods="update"
             />
             <include file="%s"/>
             <include file="%s"/>


=== Zope3/lib/python/Zope/Configuration/tests/testXML.py 1.1.2.7 => 1.1.2.8 ===
                           ''' % (ns, ns),
             '''<test:protectClass
-              name=".Contact" permission="splat" method="update"
+              name=".Contact" permission="splat" methods="update"
               />'''
             )))
 
-        self.assertEquals(protections, [(".Contact", "splat", 'update', None)])
+        self.assertEquals(protections, [(".Contact", "splat", 'update')])
         
     def testComplexDirective(self):
         xmlconfig(StringIO(
@@ -58,14 +58,14 @@
                </directive>
                           ''' % (ns, ns),
             '''<test:protectClass name=".Contact">
-              <test:protect permission="edit" method='update' />
+              <test:protect permission="edit" methods='update' />
               <test:protect permission="view" methods='name, email' />
             </test:protectClass>'''
             )))
 
         self.assertEquals(protections, [
-            (".Contact", "edit", 'update', None),
-            (".Contact", "view", None, 'name, email'),
+            (".Contact", "edit", 'update'),
+            (".Contact", "view", 'name, email'),
             ])
         
     def testBadNoPrefixComplexDirective(self):
@@ -82,7 +82,7 @@
                           ''' % (ns, ns),
 
             '''<test:protectClass name=".Contact">
-              <test:protect permission="edit" method='update' />
+              <test:protect permission="edit" methods='update' />
               <protect permission="view" methods='name, email' />
               </test:protectClass>'''
             )))
@@ -100,7 +100,7 @@
                           ''' % (ns, ns),
 
                 '''<test:protectClass name=".Contact">
-                <test2:protect permission="edit" method='update' />
+                <test2:protect permission="edit" methods='update' />
                 </test:protectClass>'''
                 )))
         except ZopeXMLConfigurationError, v: