[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ - modify z.a.folder.browser to use browser:containerViews

Fred L. Drake, Jr. fdrake at gmail.com
Thu Sep 9 15:24:24 EDT 2004


Log message for revision 27485:
  - modify z.a.folder.browser to use browser:containerViews
    (for conciseness and to set a good example)
  - fix <browser:containerViews index="..."/> to create an index page instead
    of a contents page
  


Changed:
  A   Zope3/trunk/src/zope/app/container/browser/ftests/index.txt
  U   Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py
  U   Zope3/trunk/src/zope/app/container/browser/metaconfigure.py
  U   Zope3/trunk/src/zope/app/folder/browser/configure.zcml


-=-
Added: Zope3/trunk/src/zope/app/container/browser/ftests/index.txt
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/ftests/index.txt	2004-09-09 19:08:31 UTC (rev 27484)
+++ Zope3/trunk/src/zope/app/container/browser/ftests/index.txt	2004-09-09 19:24:24 UTC (rev 27485)
@@ -0,0 +1,18 @@
+The containerViews directive lets us associate some standard forms
+for containers with an interface.  There's an "index.html" view that
+provides a listing of the contained objects without provinding any way
+to manage them (though it allows us to visit them by clicking on
+links).
+
+We can get this view from the root folder easily::
+
+  >>> response = http(r"""
+  ... GET / HTTP/1.1
+  ... """)
+
+And we can check that there isn't a form (where the management
+operations would have buttons)::
+
+  >>> body = response.getBody().lower()
+  >>> "<form" in body
+  False


Property changes on: Zope3/trunk/src/zope/app/container/browser/ftests/index.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py	2004-09-09 19:08:31 UTC (rev 27484)
+++ Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py	2004-09-09 19:24:24 UTC (rev 27485)
@@ -27,6 +27,8 @@
 from zope.app.annotation.interfaces import IAttributeAnnotatable
 from zope.app.dublincore.interfaces import IZopeDublinCore
 
+from zope.app.tests.functional import FunctionalDocFileSuite
+
 class File(Persistent):
     implements(IAttributeAnnotatable)
 
@@ -261,6 +263,7 @@
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(Test))
+    suite.addTest(FunctionalDocFileSuite("index.txt"))
     return suite
 
 if __name__=='__main__':

Modified: Zope3/trunk/src/zope/app/container/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/metaconfigure.py	2004-09-09 19:08:31 UTC (rev 27484)
+++ Zope3/trunk/src/zope/app/container/browser/metaconfigure.py	2004-09-09 19:24:24 UTC (rev 27485)
@@ -66,7 +66,7 @@
             
     if index is not None:
         page(_context, name='index.html', permission=index, for_=for_, 
-             class_=Contents, attribute='contents')
+             class_=Contents, attribute='index')
 
     if add is not None:
         viewObj = view(_context, name='+', menu='zmi_actions',

Modified: Zope3/trunk/src/zope/app/folder/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/folder/browser/configure.zcml	2004-09-09 19:08:31 UTC (rev 27484)
+++ Zope3/trunk/src/zope/app/folder/browser/configure.zcml	2004-09-09 19:24:24 UTC (rev 27485)
@@ -17,23 +17,12 @@
       permission="zope.ManageContent"
       />
 
-  <browser:page
-      name="contents.html"
-      menu="zmi_views" title="Contents"
+  <browser:containerViews
       for="zope.app.folder.interfaces.IFolder"
-      permission="zope.ManageContent"
-      class="zope.app.container.browser.contents.Contents"
-      attribute="contents"
+      contents="zope.ManageContent"
+      index="zope.View"
       />
 
-  <browser:page
-      name="index.html"
-      for="zope.app.folder.interfaces.IFolder"
-      permission="zope.View"
-      class="zope.app.container.browser.contents.Contents"
-      attribute="index"
-      />
-
   <!-- Preview view - requires zope.app.preview -->
 
   <configure package="zope.app.preview">



More information about the Zope3-Checkins mailing list