[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ merged r29897 from trunk:

Philipp von Weitershausen philikon at philikon.de
Thu Apr 7 10:41:10 EDT 2005


Log message for revision 29898:
  merged r29897 from trunk:
    For ``for`` parameter of the <browser:menuItem> and
    <browser:menuItems> directives was not marked as required in
    the directive schema, while it actually was expected to be
    required.
  

Changed:
  U   Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metadirectives.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py

-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt	2005-04-07 14:26:38 UTC (rev 29897)
+++ Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt	2005-04-07 14:41:10 UTC (rev 29898)
@@ -26,9 +26,15 @@
         HTTPResponse.getHeaders(). Do it only in output(), where the
         size of the data is known.
 
+      - For ``for`` parameter of the <browser:menuItem> and
+        <browser:menuItems> directives was not marked as required in
+        the directive schema, while it actually was expected to be
+        required.
+
     Much thanks to everyone who contributed to this release:
 
-      Jim Fulton, Stephan Richter, Bjorn Tillenius
+      Jim Fulton, Stephan Richter, Bjorn Tillenius,
+      Philipp von Weitershausen
 
       Note: If you are not listed and contributed, please add yourself. This
       note will be deleted before the release.

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metadirectives.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metadirectives.py	2005-04-07 14:26:38 UTC (rev 29897)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metadirectives.py	2005-04-07 14:41:10 UTC (rev 29898)
@@ -381,7 +381,7 @@
     for_ = GlobalObject(
         title=u"Interface",
         description=u"The interface the menu items are defined for",
-        required=False
+        required=True
         )
 
 class IMenuItem(Interface):

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py	2005-04-07 14:26:38 UTC (rev 29897)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py	2005-04-07 14:41:10 UTC (rev 29898)
@@ -1025,6 +1025,33 @@
 
         self.assert_(isinstance(v, V1))
 
+    def testMenuItemNeedsFor(self):
+	# <browser:menuItem> directive fails if no 'for' argument was provided
+	from zope.configuration.exceptions import ConfigurationError
+        self.assertRaises(ConfigurationError, xmlconfig, StringIO(template %
+            '''
+            <browser:menu
+                id="test_menu" title="Test menu" />
+	    <browser:menuItem
+	        title="Test Entry"
+	        menu="test_menu"
+		action="@@test"
+		/>
+            '''
+            ))
+
+	# it works, when the argument is there and a valid interface
+	xmlconfig(StringIO(template %
+            '''
+	    <browser:menuItem
+                for="zope.app.component.tests.views.IC"
+	        title="Test Entry"
+	        menu="test_menu"
+		action="@@test"
+		/>
+            '''
+	    ))
+	
 def test_suite():
     loader=unittest.TestLoader()
     return loader.loadTestsFromTestCase(Test)



More information about the Zope3-Checkins mailing list