[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI/tests - testTabsDirective.py:1.1.2.8 testZMIViewService.py:1.1.2.7 testZMIViewUtility.py:1.1.2.10
Jim Fulton
jim@zope.com
Thu, 23 May 2002 14:01:49 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI/tests
In directory cvs.zope.org:/tmp/cvs-serv26429/lib/python/Zope/App/ZMI/tests
Modified Files:
Tag: Zope-3x-branch
testTabsDirective.py testZMIViewService.py
testZMIViewUtility.py
Log Message:
This all started with wanting to be able to use url;view in a ZPT path. :)
That lead me to:
- Massive traversal refactoring.
Namespace handling is now centralized in Zope.App.Traversing.
- ZPT refactoring, including some renaming that touches pretty much everything. :)
- The application specific ZPT support was moved into
Zope.App.PageTemplate.
- To get page template files (for use in views):
from Zope.App.PageTemplate import ViewPageTemplateFile
- Fixed up security so that ZPT expressions only have access to
safe builtins and so that modules namespace does imports safely.
- Got ZPTPage working!
- renaming url to absolute_url and got absolute_url to work in paths.
- Cleaned up the (as yet unused) RestrictedInterpreter module in
Zope.Security. In particular, changed to use a separate
RestrictedBuiltins module.
=== Zope3/lib/python/Zope/App/ZMI/tests/testTabsDirective.py 1.1.2.7 => 1.1.2.8 ===
from Zope.App.ZMI.tests.sampleInterfaces import *
+
from Zope.App.OFS.ServiceManager.tests.PlacefulSetup\
import PlacefulSetup
from Zope.ComponentArchitecture import getService
@@ -40,27 +41,28 @@
def testZMITabDirective(self):
xmlconfig( StringIO("""
<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:zmi='http://namespaces.zope.org/zmi'>
- <directive name="tabs" attributes="for"
- namespace="http://namespaces.zope.org/zmi"
- handler="Zope.App.ZMI.TabsDirective.">
- <subdirective name="tab" attributes="label,action,filter" />
- </directive>
- <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I1">
- <zmi:tab label="Edit" action="edit" />
- <zmi:tab label="History" action="history" />
- </zmi:tabs>
- <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I2">
- <zmi:tab label="Update" action="update_magic" />
- <zmi:tab label="Organize" action="organize_magic" />
- </zmi:tabs>
-
- </zopeConfigure>
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:zmi='http://namespaces.zope.org/zmi'>
+
+ <directive name="tabs" attributes="for"
+ namespace="http://namespaces.zope.org/zmi"
+ handler="Zope.App.ZMI.TabsDirective.">
+ <subdirective name="tab" attributes="label,action,filter" />
+ </directive>
+ <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I1">
+ <zmi:tab label="Edit" action="edit" />
+ <zmi:tab label="History" action="history" />
+ </zmi:tabs>
+ <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I2">
+ <zmi:tab label="Update" action="update_magic" />
+ <zmi:tab label="Organize" action="organize_magic" />
+ </zmi:tabs>
+
+ </zopeConfigure>
"""))
- getService(None,"Adapters").provideAdapter(I1, ITraverser,
- FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I1, ITraverser, FakeTraverser)
self.assertEqual(list(ZMIViews.getViews(O2())),
[
@@ -72,32 +74,30 @@
)
-
def testZMITabDirectiveWithFilters(self):
xmlconfig( StringIO("""
<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:zmi='http://namespaces.zope.org/zmi'>
- <directive name="tabs" attributes="for"
- namespace="http://namespaces.zope.org/zmi"
- handler="Zope.App.ZMI.TabsDirective.">
- <subdirective name="tab" attributes="label,action,filter" />
- </directive>
- <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I1">
- <zmi:tab label="Edit" action="edit" />
- <zmi:tab label="History" action="history" filter="python: 1==2" />
- </zmi:tabs>
- <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I2">
- <zmi:tab label="Update" action="update_magic" />
- <zmi:tab label="Organize" action="organize_magic" />
- </zmi:tabs>
-
- </zopeConfigure>
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:zmi='http://namespaces.zope.org/zmi'>
+ <directive name="tabs" attributes="for"
+ namespace="http://namespaces.zope.org/zmi"
+ handler="Zope.App.ZMI.TabsDirective.">
+ <subdirective name="tab" attributes="label,action,filter" />
+ </directive>
+ <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I1">
+ <zmi:tab label="Edit" action="edit" />
+ <zmi:tab label="History" action="history" filter="python: 1==2" />
+ </zmi:tabs>
+ <zmi:tabs for="Zope.App.ZMI.tests.sampleInterfaces.I2">
+ <zmi:tab label="Update" action="update_magic" />
+ <zmi:tab label="Organize" action="organize_magic" />
+ </zmi:tabs>
+ </zopeConfigure>
"""))
- getService(None,"Adapters").provideAdapter(I1, ITraverser,
- FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I1, ITraverser, FakeTraverser)
self.assertEqual(list(ZMIViews.getViews(O2())),
[
=== Zope3/lib/python/Zope/App/ZMI/tests/testZMIViewService.py 1.1.2.6 => 1.1.2.7 ===
def testAddView(self):
- getService(None,"Adapters").provideAdapter(I1, ITraverser,
- FakeTraverser)
- getService(None,"Adapters").provideAdapter(I2, ITraverser,
- FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I1, ITraverser, FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I2, ITraverser, FakeTraverser)
service = ZMIViewService()
service.registerView(I1, 'Edit', 'edit')
@@ -53,10 +53,10 @@
def testZMIFilter(self):
- getService(None,"Adapters").provideAdapter(I1, ITraverser,
- FakeTraverser)
- getService(None,"Adapters").provideAdapter(I2, ITraverser,
- FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I1, ITraverser, FakeTraverser)
+ getService(None,"Adapters").provideAdapter(
+ I2, ITraverser, FakeTraverser)
service = ZMIViewService()
service.registerView(I1, 'Edit', 'edit', 'python: 2==2')
=== Zope3/lib/python/Zope/App/ZMI/tests/testZMIViewUtility.py 1.1.2.9 => 1.1.2.10 ===
from Zope.App.ZMI.ZMIViewUtility import ZMIViewUtility
from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
-from Zope.App.ZopePublication.Traversers import DefaultTraverser
+from Zope.App.ZopePublication.Traversers import TestTraverser
from Zope.Security.SecurityManagement import setSecurityPolicy
from Zope.Security.SecurityManagement import newSecurityManager
from Zope.Exceptions import Unauthorized
@@ -67,7 +67,7 @@
provideService('ZMIViewService', Service())
getService(None,"Views").provideView(I, 'a3', IBrowserPublisher, V)
getService(None, "Views").provideView(None, '_traverse',
- IBrowserPublisher, DefaultTraverser)
+ IBrowserPublisher, TestTraverser)
defineChecker(C, NamesChecker(['a1', 'a2', 'a3'], CheckerPublic,
abad='waaa'))