Skip to content

Commit

Permalink
- modify z.a.folder.browser to use browser:containerViews
Browse files Browse the repository at this point in the history
  (for conciseness and to set a good example)
- fix <browser:containerViews index="..."/> to create an index page instead
  of a contents page

(merged from Zope3 trunk revision 27485)
  • Loading branch information
freddrake committed Sep 9, 2004
2 parents a8355db + a349dfb commit 4e4bb87
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions browser/ftests/index.txt
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions browser/ftests/test_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -261,6 +263,7 @@ def test_paste_for_deleted_clipboard_item(self):
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(Test))
suite.addTest(FunctionalDocFileSuite("index.txt"))
return suite

if __name__=='__main__':
Expand Down
2 changes: 1 addition & 1 deletion browser/metaconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def containerViews(_context, for_, contents=None, add=None, index=None):

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',
Expand Down

0 comments on commit 4e4bb87

Please sign in to comment.