[Checkins] SVN: bluebream/website/docs/v1.0/tutorial1.rst make the main application container a site

Baiju M baiju.m.mail at gmail.com
Sun Mar 28 02:58:52 EDT 2010


Log message for revision 110260:
  make the main application container a 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:47:42 UTC (rev 110259)
+++ bluebream/website/docs/v1.0/tutorial1.rst	2010-03-28 06:58:52 UTC (rev 110260)
@@ -772,17 +772,17 @@
 
 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 container interface as
+interface.  You can name the main application container interface as
 ``ICollector``, the easiest way to create a container is to inherit
-from ``zope.container.interfaces.IContainer`` interface.  You can
-modify the file named ``src/tc/main/interfaces.py`` to add new
-interfaces like this::
+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.container.interfaces import IContainer
+  from zope.site.interfaces import IFolder
   from zope.schema import TextLine
   from zope.schema import Text
 
-  class ICollector(IContainer):
+  class ICollector(IFolder):
       """The main application container"""
 
       name = TextLine(
@@ -811,15 +811,15 @@
 
 Next, you need to implement this interface.  To implement
 ``IContainer``, it is recommended to inherit from
-``zope.container.btree.BTreeContainer``.  You can create the
-implementation in ``src/tc/main/ticketcollector.py``::
+``zope.site.folder.Folder``.  You can create the implementation in
+``src/tc/main/ticketcollector.py``::
 
   from zope.interface import implements
-  from zope.container.btree import BTreeContainer
+  from zope.site.folder import Folder
 
   from tc.main.interfaces import ICollector
 
-  class Collector(BTreeContainer):
+  class Collector(Folder):
       """A simple implementation of a collector using B-Tree
       Container."""
 
@@ -891,6 +891,7 @@
 inside ``src/tc/main/views.py`` like this::
 
   from zope.container.interfaces import INameChooser
+  from zope.site import LocalSiteManager
   from zope.formlib import form
 
   from tc.main.interfaces import ICollector
@@ -910,6 +911,7 @@
           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*



More information about the checkins mailing list