Commit 24184a87 authored by Christian Theune's avatar Christian Theune

Updated manual to reflect reality about Zope 2 security and views.

parent 6ecd6200
...@@ -268,9 +268,6 @@ view class are: ...@@ -268,9 +268,6 @@ view class are:
attribute. Typically this comes from a base class, such as attribute. Typically this comes from a base class, such as
``BrowserView``. ``BrowserView``.
* They need to be initialized with the Zope 2 security system, as
otherwise you cannot use the view.
* This also means they need to be part of the Zope 2 acquisition * This also means they need to be part of the Zope 2 acquisition
system, as this is a requirement for Zope 2 security to system, as this is a requirement for Zope 2 security to
function. The ``BrowserView`` base class, available from function. The ``BrowserView`` base class, available from
...@@ -283,22 +280,17 @@ An example of a simple view:: ...@@ -283,22 +280,17 @@ An example of a simple view::
from Products.Five import BrowserView from Products.Five import BrowserView
class SimpleFolderView(BrowserView): class SimpleFolderView(BrowserView):
security = ClassSecurityInfo()
security.declarePublic('eagle')
def eagle(self): def eagle(self):
"""Test """Test
""" """
return "The eagle has landed: %s" % self.context.objectIds() return "The eagle has landed: %s" % self.context.objectIds()
InitializeClass(SimpleFolderView)
Note that it is not a good idea to give a view class its own Note that it is not a good idea to give a view class its own
``index_html``, as this confuses Five's view lookup machinery. ``index_html``, as this confuses Five's view lookup machinery.
As you can see, the class is initialized with the Zope 2 security This view uses methods in Python, but you can also use other Zope 2 mechanisms
system. This view uses methods in Python, but you can also use other such as ``PageTemplateFile``.
Zope 2 mechanisms such as ``PageTemplateFile``.
Finally, we need to hook up the pages through ZCML:: Finally, we need to hook up the pages through ZCML::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment