[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py Fix tests now that the old way of defining directives is gone.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jul 13 19:48:45 EDT 2004


Log message for revision 26516:
  Fix tests now that the old way of defining directives is gone.
  
  On the way I made the file more readable for Emacs and edited the ZCML 
  strings to follow the style guide.
  


Changed:
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py


-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2004-07-13 23:47:28 UTC (rev 26515)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2004-07-13 23:48:45 UTC (rev 26516)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 import os
 import unittest
 from cStringIO import StringIO
@@ -109,14 +108,15 @@
                          None)
 
         xmlconfig(StringIO(template % (
-            """
-            <browser:page name="test"
-                          class="zope.app.component.tests.views.V1"
-                          for="zope.app.component.tests.views.IC"
-                          permission="zope.Public"
-                          attribute="index"
-                          />
-            """
+            '''
+            <browser:page
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                />
+            '''
             )))
 
         v = queryView(ob, 'test', request)
@@ -129,17 +129,19 @@
                          
 
         xmlconfig(StringIO(template % (
-            """
-            <browser:menu id="test_menu" title="Test menu" />
-            <browser:page name="test"
-                          class="zope.app.component.tests.views.V1"
-                          for="zope.app.component.tests.views.IC"
-                          permission="zope.Public"
-                          template="%s" 
-                          menu="test_menu"
-                          title="Test View"
-                          />
-            """ % testtemplate
+            '''
+            <browser:menu
+                id="test_menu" title="Test menu" />
+            <browser:page
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                template="%s" 
+                menu="test_menu"
+                title="Test View"
+                />
+            ''' % testtemplate
             )))
 
         menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -156,16 +158,18 @@
         testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
                          
         xmlconfig(StringIO(template % (
-            """
-            <browser:menu id="test_menu" title="Test menu"/>
-            <browser:page name="test"
-                          for="zope.app.component.tests.views.IC"
-                          permission="zope.Public"
-                          template="%s" 
-                          menu="test_menu"
-                          title="Test View"
-                          />
-            """ % testtemplate
+            '''
+            <browser:menu
+                id="test_menu" title="Test menu"/>
+            <browser:page
+                name="test"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                template="%s" 
+                menu="test_menu"
+                title="Test View"
+                />
+            ''' % testtemplate
             )))
 
         menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -182,17 +186,20 @@
         testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
 
         xmlconfig(StringIO(template % (
-            """
-            <browser:menu id="test_menu" title="Test menu" />
-            <browser:pages for="zope.app.component.tests.views.IC"
-                          permission="zope.Public">
-                <browser:page name="test"
-                              template="%s" 
-                              menu="test_menu"
-                              title="Test View"
-                              />
+            '''
+            <browser:menu
+                id="test_menu" title="Test menu" />
+            <browser:pages
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public">
+              <browser:page
+                  name="test"
+                  template="%s" 
+                  menu="test_menu"
+                  title="Test View"
+                  />
             </browser:pages>                  
-            """ % testtemplate
+            ''' % testtemplate
             )))
 
         menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -210,18 +217,21 @@
                          
 
         xmlconfig(StringIO(template % (
-            """
-            <browser:menu id="test_menu" title="Test menu" />
-            <browser:pages for="zope.app.component.tests.views.IC"
-                           class="zope.app.component.tests.views.V1"
-                           permission="zope.Public">
-                <browser:page name="test"
-                              template="%s" 
-                              menu="test_menu"
-                              title="Test View"
-                              />
+            '''
+            <browser:menu
+                id="test_menu" title="Test menu" />
+            <browser:pages
+                for="zope.app.component.tests.views.IC"
+                class="zope.app.component.tests.views.V1"
+                permission="zope.Public">
+              <browser:page
+                  name="test"
+                  template="%s" 
+                  menu="test_menu"
+                  title="Test View"
+                  />
             </browser:pages>                  
-            """ % testtemplate
+            ''' % testtemplate
             )))
 
         menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -236,10 +246,11 @@
                                    None), None)
 
         xmlconfig(StringIO(template % (
-            """
-            <browser:defaultView name="test"
-                                 for="zope.app.component.tests.views.IC" />
-            """
+            '''
+            <browser:defaultView
+                name="test"
+                for="zope.app.component.tests.views.IC" />
+            '''
             )))
 
         self.assertEqual(getDefaultViewName(ob, request
@@ -254,12 +265,12 @@
             <browser:layer name="zmi" />
             <browser:skin name="zmi" layers="zmi default" />
             <browser:resource
-                  name="test"
-                  factory="zope.app.component.tests.views.RZMI"
-                  layer="zmi" />
+                name="test"
+                factory="zope.app.component.tests.views.RZMI"
+                layer="zmi" />
             <browser:resource
-                  name="test"
-                  factory="zope.app.component.tests.views.R1" />
+                name="test"
+                factory="zope.app.component.tests.views.R1" />
             '''
             )))
 
@@ -277,18 +288,18 @@
             <browser:skin name="zmi" layers="zmi default" />
             <browser:defaultSkin name="zmi" />
             <browser:page name="test"
-                  class="zope.app.component.tests.views.VZMI"
-                  layer="zmi"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  attribute="index"
-                  />
+                class="zope.app.component.tests.views.VZMI"
+                layer="zmi"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                />
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  attribute="index"
-                  />
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                />
             '''
             )))
         v = queryView(ob, 'test', TestRequest(skin=''))
@@ -298,23 +309,23 @@
         self.assertEqual(queryView(ob, 'test', request, None), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <browser:layer name="zmi" />
             <browser:skin name="zmi" layers="zmi default" />
             <browser:page name="test"
-                  class="zope.app.component.tests.views.VZMI"
-                  layer="zmi"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  attribute="index"
-                  />
+                class="zope.app.component.tests.views.VZMI"
+                layer="zmi"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                />
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  attribute="index"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                />
+            '''
             )))
 
         v = queryView(ob, 'test', request)
@@ -329,12 +340,12 @@
         path2 = os.path.join(tests_path, 'testfiles', 'test2.pt')
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <browser:i18n-resource name="test" defaultLanguage="fr">
               <browser:translation language="en" file="%s" />
               <browser:translation language="fr" file="%s" />
             </browser:i18n-resource>
-            """ % (path1, path2)
+            ''' % (path1, path2)
             )))
 
         v = getResource('test', request)
@@ -346,37 +357,37 @@
 
         # translation must be provided for the default language
         config = StringIO(template % (
-            """
+            '''
             <browser:i18n-resource name="test" defaultLanguage="fr">
               <browser:translation language="en" file="%s" />
               <browser:translation language="lt" file="%s" />
             </browser:i18n-resource>
-            """ % (path1, path2)
+            ''' % (path1, path2)
             ))
         self.assertRaises(ConfigurationError, xmlconfig, config)
 
         # files and images can't be mixed
         config = StringIO(template % (
-            """
+            '''
             <browser:i18n-resource name="test" defaultLanguage="fr">
               <browser:translation language="en" file="%s" />
               <browser:translation language="fr" image="%s" />
             </browser:i18n-resource>
-            """ % (path1, path2)
+            ''' % (path1, path2)
             ))
         self.assertRaises(ConfigurationError, xmlconfig, config)
 
     def testInterfaceProtectedPage(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  attribute="index"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-              allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                attribute="index"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                allowed_interface="zope.app.component.tests.views.IV"
+                />
+            '''
             ))
 
         v = getView(ob, 'test', request)
@@ -386,15 +397,15 @@
 
     def testAttributeProtectedPage(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  attribute="action"
-                  permission="zope.Public"
-                  allowed_attributes="action"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                attribute="action"
+                permission="zope.Public"
+                allowed_attributes="action"
+                />
+            '''
             ))
 
         v = getView(ob, 'test', request)
@@ -404,16 +415,16 @@
 
     def testInterfaceAndAttributeProtectedPage(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  attribute="index"
-                  allowed_attributes="action"
-                  allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                attribute="index"
+                allowed_attributes="action"
+                allowed_interface="zope.app.component.tests.views.IV"
+                />
+            '''
             ))
 
         v = getView(ob, 'test', request)
@@ -422,16 +433,16 @@
 
     def testDuplicatedInterfaceAndAttributeProtectedPage(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  attribute="index"
-                  permission="zope.Public"
-                  allowed_attributes="action index"
-                  allowed_interface="zope.app.component.tests.views.IV"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                attribute="index"
+                permission="zope.Public"
+                allowed_attributes="action index"
+                allowed_interface="zope.app.component.tests.views.IV"
+                />
+            '''
             ))
 
         v = getView(ob, 'test', request)
@@ -440,16 +451,16 @@
 
     def test_class_w_implements(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page
-                  name="test"
-                  class="
+                name="test"
+                class="
              zope.app.publisher.browser.tests.test_directives.C_w_implements"
-                  for="zope.app.component.tests.views.IC"
-                  attribute="index"
-                  permission="zope.Public"
-                  />
-            """
+                for="zope.app.component.tests.views.IC"
+                attribute="index"
+                permission="zope.Public"
+                />
+            '''
             ))
 
         v = getView(ob, 'test', request)
@@ -461,14 +472,14 @@
             ConfigurationError,
             xmlconfig,
             StringIO(template %
-            """
+            '''
             <browser:page name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  attribute="index"
-                  allowed_attributes="action index"
-                  />
-            """
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                attribute="index"
+                allowed_attributes="action index"
+                />
+            '''
             ))
 
 
@@ -477,18 +488,18 @@
         test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:pages
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
 
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
-                <browser:page name="test.html" template="%s" />
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
+              <browser:page name="test.html" template="%s" />
             </browser:pages>
-            """ % test3
+            ''' % test3
             ))
 
         v = getView(ob, 'index.html', request)
@@ -502,18 +513,18 @@
         self.assertEqual(queryView(ob, 'test', request), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.publisher.browser.tests.test_directives.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
+                name="test"
+                class="zope.app.publisher.browser.tests.test_directives.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
 
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
             </browser:view>
-            """
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -533,14 +544,14 @@
         self.assertEqual(queryView(ob, 'test', request), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.publisher.browser.tests.test_directives.CV"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  />
-            """
+                name="test"
+                class="zope.app.publisher.browser.tests.test_directives.CV"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                />
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -551,14 +562,14 @@
         self.assertEqual(queryView(ob, 'test', request), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.publisher.browser.tests.test_directives.NCV"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  />
-            """
+                name="test"
+                class="zope.app.publisher.browser.tests.test_directives.NCV"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                />
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -570,19 +581,19 @@
         test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
 
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
-                <browser:page name="test.html" template="%s" />
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
+              <browser:page name="test.html" template="%s" />
             </browser:view>
-            """ % test3
+            ''' % test3
             ))
 
         view = getView(ob, 'test', request)
@@ -605,20 +616,20 @@
         test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
-
-                <browser:defaultPage name="test.html" />
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
-                <browser:page name="test.html" template="%s" />
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
+            
+              <browser:defaultPage name="test.html" />
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
+              <browser:page name="test.html" template="%s" />
             </browser:view>
-            """ % test3
+            ''' % test3
             ))
 
         view = getView(ob, 'test', request)
@@ -640,18 +651,18 @@
         """Tests proper traversal of a page defined for a view."""
         
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public" />
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public" />
 
             <browser:page name="index.html"
                 for="zope.app.component.tests.views.IV" 
                 class="zope.app.publisher.browser.tests.test_directives.CV"
                 permission="zope.Public" />
-            """
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -667,18 +678,18 @@
         case.
         """
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
-                  name="test"
-                  class="zope.app.publisher.browser.tests.test_directives.VT"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public" />
+                name="test"
+                class="zope.app.publisher.browser.tests.test_directives.VT"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public" />
 
             <browser:page name="index.html"
                 for="zope.app.component.tests.views.IV" 
                 class="zope.app.publisher.browser.tests.test_directives.CV"
                 permission="zope.Public" />
-            """
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -692,26 +703,21 @@
                          None)
 
         xmlconfig(StringIO(template %
-            """
-            <directives namespace="http://namespaces.zope.org/zope">
-              <directive name="permission"
-                 attributes="id title description"
-                 handler="
-             zope.app.security.metaconfigure.definePermission" />
-            </directives>
-
+            '''
+            <include package="zope.app.security" file="meta.zcml" />
+            
             <permission id="zope.TestPermission" title="Test permission" />
 
             <browser:pages
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.TestPermission"
-                  >
-
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.TestPermission"
+                >
+             
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
             </browser:pages>
-            """
+            '''
             ))
 
         v = getView(ob, 'index.html', request)
@@ -726,27 +732,22 @@
                          None)
 
         xmlconfig(StringIO(template %
-            """
-            <directives namespace="http://namespaces.zope.org/zope">
-              <directive name="permission"
-                 attributes="id title description"
-                 handler="
-             zope.app.security.metaconfigure.definePermission" />
-            </directives>
+            '''
+            <include package="zope.app.security" file="meta.zcml" />
 
             <permission id="zope.TestPermission" title="Test permission" />
 
             <browser:view
-                  name="test"
-                  class="zope.app.component.tests.views.V1"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
-
-                <browser:page name="index.html" attribute="index" />
-                <browser:page name="action.html" attribute="action" />
+                name="test"
+                class="zope.app.component.tests.views.V1"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
+             
+              <browser:page name="index.html" attribute="index" />
+              <browser:page name="action.html" attribute="action" />
             </browser:view>
-            """
+            '''
             ))
 
         view = getView(ob, 'test', request)
@@ -759,27 +760,27 @@
         self.assertEqual(queryView(ob, 'test', request), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:layer name="layer" />
             <browser:skin name="skinny" layers="layer default" />
             <browser:pages
-                  for="*"
-                  class="zope.app.component.tests.views.V1"
-                  permission="zope.Public"
-                  >
-
-                <browser:page name="index.html" attribute="index" />
+                for="*"
+                class="zope.app.component.tests.views.V1"
+                permission="zope.Public"
+                >
+             
+              <browser:page name="index.html" attribute="index" />
             </browser:pages>
             <browser:pages
-                  for="*"
-                  class="zope.app.component.tests.views.V1"
-                  layer="layer"
-                  permission="zope.Public"
-                  >
-
-                <browser:page name="index.html" attribute="action" />
+                for="*"
+                class="zope.app.component.tests.views.V1"
+                layer="layer"
+                permission="zope.Public"
+                >
+            
+              <browser:page name="index.html" attribute="action" />
             </browser:pages>
-            """
+            '''
             ))
 
         v = getView(ob, 'index.html', request)
@@ -793,12 +794,12 @@
         self.assertEqual(queryResource('test', request), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:resource
-                  name="index.html"
-                  file="%s"
-                  />
-            """ % path
+                name="index.html"
+                file="%s"
+                />
+            ''' % path
             ))
 
         r = ProxyFactory(getResource('index.html', request))
@@ -821,12 +822,12 @@
         path = os.path.join(tests_path, 'testfiles', 'test.pt')
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <browser:layer name="zmi" />
             <browser:skin name="zmi" layers="zmi default" />
             <browser:resource name="test" file="%s" 
                   layer="zmi" />
-            """ % path
+            ''' % path
             )))
 
         self.assertEqual(queryResource('test', request), None)
@@ -842,13 +843,13 @@
                          None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page
-                  name="index.html"
-                  template="%s"
-                  permission="zope.Public"
-                  for="zope.app.component.tests.views.IC" />
-            """ % path
+                name="index.html"
+                template="%s"
+                permission="zope.Public"
+                for="zope.app.component.tests.views.IC" />
+            ''' % path
             ))
 
         v = getView(ob, 'index.html', request)
@@ -861,14 +862,14 @@
                          None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page
-                  name="index.html"
-                  template="%s"
-                  permission="zope.Public"
+                name="index.html"
+                template="%s"
+                permission="zope.Public"
           class="zope.app.publisher.browser.tests.templateclass.templateclass"
-                  for="zope.app.component.tests.views.IC" />
-            """ % path
+                for="zope.app.component.tests.views.IC" />
+            ''' % path
             ))
 
         v = getView(ob, 'index.html', request)
@@ -882,32 +883,27 @@
                          None)
 
         xmlconfig(StringIO(template %
-            """
-            <directives namespace="http://namespaces.zope.org/zope">
-              <directive name="permission"
-                 attributes="id title description"
-                 handler="
-               zope.app.security.metaconfigure.definePermission" />
-            </directives>
+            '''
+            <include package="zope.app.security" file="meta.zcml" />
 
             <permission id="zope.TestPermission" title="Test permission" />
 
             <browser:page
-                  name="xxx.html"
-                  template="%s"
-                  permission="zope.TestPermission"
-                  for="zope.app.component.tests.views.IC" />
-            """ % path
+                name="xxx.html"
+                template="%s"
+                permission="zope.TestPermission"
+                for="zope.app.component.tests.views.IC" />
+            ''' % path
             ))
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:page
-                  name="index.html"
-                  template="%s"
-                  permission="zope.Public"
-                  for="zope.app.component.tests.views.IC" />
-            """ % path
+                name="index.html"
+                template="%s"
+                permission="zope.Public"
+                for="zope.app.component.tests.views.IC" />
+            ''' % path
             ))
 
         v = getView(ob, 'xxx.html', request)
@@ -925,12 +921,12 @@
             ConfigurationError,
             xmlconfig,
             StringIO(template %
-            """
+            '''
             <browser:page
-                  template="%s"
-                  for="zope.app.component.tests.views.IC"
-                  />
-            """ % path
+                template="%s"
+                for="zope.app.component.tests.views.IC"
+                />
+            ''' % path
             ))
 
     def testtemplateAndPage(self):
@@ -939,16 +935,16 @@
             ConfigurationError,
             xmlconfig,
             StringIO(template %
-            """
+            '''
             <browser:view
-                  name="index.html"
-                  template="%s"
-                  for="zope.app.component.tests.views.IC"
-                  permission="zope.Public"
-                  >
-               <browser:page name="foo.html" attribute="index" />
+                name="index.html"
+                template="%s"
+                for="zope.app.component.tests.views.IC"
+                permission="zope.Public"
+                >
+              <browser:page name="foo.html" attribute="index" />
             </browser:view>
-            """ % path
+            ''' % path
             ))
 
     def testViewThatProvidesAnInterface(self):
@@ -956,21 +952,21 @@
         self.assertEqual(queryView(ob, 'test', request, None), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
                 name="test"
                 class="zope.app.component.tests.views.V1"
                 for="zope.app.component.tests.views.IC"
                 permission="zope.Public"
                 />
-            """
+            '''
             ))
 
         v = queryView(ob, 'test', request, None, providing=IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
                 name="test"
                 class="zope.app.component.tests.views.V1"
@@ -978,7 +974,7 @@
                 provides="zope.app.component.tests.views.IV"
                 permission="zope.Public"
                 />
-            """
+            '''
             ))
 
         v = queryView(ob, 'test', request, None, providing=IV)
@@ -990,27 +986,27 @@
         self.assertEqual(queryView(ob, '', request, None, providing=IV), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
                 class="zope.app.component.tests.views.V1"
                 for="zope.app.component.tests.views.IC"
                 permission="zope.Public"
                 />
-            """
+            '''
             ))
 
         v = queryView(ob, '', request, None, providing=IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <browser:view
                 class="zope.app.component.tests.views.V1"
                 for="zope.app.component.tests.views.IC"
                 provides="zope.app.component.tests.views.IV"
                 permission="zope.Public"
                 />
-            """
+            '''
             ))
 
         v = queryView(ob, '', request, None, providing=IV)



More information about the Zope3-Checkins mailing list