[Zope3-checkins] SVN: Zope3/trunk/ addMenuItem supports a layer attribute

Julien Anguenot ja at nuxeo.com
Fri Sep 30 13:05:20 EDT 2005


Log message for revision 38705:
  addMenuItem supports a layer attribute

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py
  A   Zope3/trunk/src/zope/app/publisher/browser/tests/addmenuitems.zcml
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-09-30 14:58:33 UTC (rev 38704)
+++ Zope3/trunk/doc/CHANGES.txt	2005-09-30 17:05:19 UTC (rev 38705)
@@ -10,6 +10,8 @@
 
     New features
 
+      - addMenuItem directive supports a `layer` attribute.
+
       - Formalized the Publisher Response API.
 
         + Until now the publisher made assumptions about the form of ouput of
@@ -71,7 +73,7 @@
 
     Much thanks to everyone who contributed to this release:
 
-      Stephan Richter, Roger Ineichen, Marius Gedminas
+      Stephan Richter, Roger Ineichen, Marius Gedminas, Julien Anguenot
 
     Note: If you are not listed and contributed, please add yourself. This
           note will be deleted before the release.

Modified: Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py	2005-09-30 14:58:33 UTC (rev 38704)
+++ Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py	2005-09-30 17:05:19 UTC (rev 38705)
@@ -555,6 +555,13 @@
         required=False,
         )
 
+    layer = LayerField(
+        title=u"The layer the custom view is declared for",
+        description=u"The default layer for which the custom view is "
+                    u"applicable. By default it is applied to all layers.",
+        required=False
+        )
+
 #
 # misc. directives
 #

Added: Zope3/trunk/src/zope/app/publisher/browser/tests/addmenuitems.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/addmenuitems.zcml	2005-09-30 14:58:33 UTC (rev 38704)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/addmenuitems.zcml	2005-09-30 17:05:19 UTC (rev 38705)
@@ -0,0 +1,24 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <browser:layer name="center"/>
+
+  <browser:addform
+      schema=".tests.test_menudirectives.I1"
+      name="add2.html"
+      content_factory=".tests.test_menudirectives.C1"
+      permission="zope.Public"
+      layer="center"
+      />
+
+  <browser:addMenuItem
+      class=".tests.test_menudirectives.I1"
+      title="Add menu Item"
+      view="add2.html"
+      permission="zope.Public" 
+      layer="center"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/publisher/browser/tests/addmenuitems.zcml
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py	2005-09-30 14:58:33 UTC (rev 38704)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py	2005-09-30 17:05:19 UTC (rev 38705)
@@ -366,9 +366,28 @@
        <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>)))
     """
 
+from zope.configuration.xmlconfig import XMLConfig
+
+import zope.app
+import zope.app.form.browser
+
+from zope.app.testing import placelesssetup
+
+class TestAddMenuItem(placelesssetup.PlacelessSetup, unittest.TestCase):
+
+    def setUp(self):
+        super(TestAddMenuItem, self).setUp()
+        XMLConfig('meta.zcml', zope.app.form.browser)()
+        XMLConfig('meta.zcml', zope.app.publisher.browser)()
+
+    def test_addMenuItemDirectives(self):
+        XMLConfig('tests/addmenuitems.zcml', zope.app.publisher.browser)()
+
 def test_suite():
     return unittest.TestSuite((
         DocTestSuite(),
+        unittest.makeSuite(TestAddMenuItem),
         ))
 
-if __name__ == '__main__': unittest.main()
+if __name__ == '__main__':
+    unittest.main()



More information about the Zope3-Checkins mailing list