[Checkins] SVN: bluebream/website/docs/v1.0/tutorial1.rst mention about site
Baiju M
baiju.m.mail at gmail.com
Sun Mar 28 03:09:12 EDT 2010
Log message for revision 110261:
mention about site
Changed:
U bluebream/website/docs/v1.0/tutorial1.rst
-=-
Modified: bluebream/website/docs/v1.0/tutorial1.rst
===================================================================
--- bluebream/website/docs/v1.0/tutorial1.rst 2010-03-28 06:58:52 UTC (rev 110260)
+++ bluebream/website/docs/v1.0/tutorial1.rst 2010-03-28 07:09:12 UTC (rev 110261)
@@ -773,10 +773,11 @@
As the first step for creating the main application container object
which is going to hold all other objects, you need to create an
interface. You can name the main application container interface as
-``ICollector``, the easiest way to create a container is to inherit
-from ``zope.site.interfaces.IFolder`` interface. You can modify the
-file named ``src/tc/main/interfaces.py`` to add new interfaces like
-this::
+``ICollector``. To make this a container, user need to inherit from
+``zope.container.interfaces.IContainer`` or any derived interfaces.
+For application containers, it is recommend to inherit from
+``zope.site.interfaces.IFolder`` interface. You can modify the file
+named ``src/tc/main/interfaces.py`` to add new interfaces like this::
from zope.site.interfaces import IFolder
from zope.schema import TextLine
@@ -890,7 +891,6 @@
package to create a form. You can add the view class definition
inside ``src/tc/main/views.py`` like this::
- from zope.container.interfaces import INameChooser
from zope.site import LocalSiteManager
from zope.formlib import form
@@ -904,19 +904,23 @@
def createAndAdd(self, data):
name = data['name']
- description = data.get('description')
- namechooser = INameChooser(self.context)
+ description = data.get('description', u'')
collector = Collector()
collector.name = name
collector.description = description
- name = namechooser.chooseName(name, collector)
self.context[name] = collector
collector.setSiteManager(LocalSiteManager(collector))
self.request.response.redirect(".")
The ``createAndAdd`` function will be called when used submit *Add*
-button from web form.
+button from web form. The second last line is very important::
+ collector.setSiteManager(LocalSiteManager(collector))
+
+This line add a site manager to the collector, so that it can be used
+as a persistent component registry to register local components like
+local utilities.
+
The last last thing you need to do is registering this view in ZCML.
As you have already seen in the previous chapter, ``browser:page``
directive is used for registering pages. You can give the name as
More information about the checkins
mailing list