[Zope3-dev] Thoughts on having multiple zcml-defined sites

Jim Fulton jim at zope.com
Mon Aug 9 10:24:12 EDT 2004


We're interested in making it possible to have local sites
defined via ZCML rather than TTW.  Steve has immediate need for
this and will be trying to make this work.

Here are some thoughts of mine on the subject.

- Not all ZCML directives are or can be site specific. The most
   important example of this that I can think of is content/class
   permission declarations.

- We (Steve and friends :) need to double check that directives that
   are site specific actually use the thread-local site manager.

- New global site managers are defined by defining named
   zope.component.service.IGlobalServiceManager
   utilities, which can be instances of
   zope.component.service.GlobalServiceManager.

   The default global site manager will have the name ''.
   Note that this default site manager is needed for bootstrapping.
   It has the utility service needed to register the other
   global service managers.

- Update the pickling code for GlobalServiceManager to use
   utilities.  I can provide more details on this or possibly
   help when you get to this point.

- Create a new ZCML site directive that selects a different site:

     <site name="foo">
        ....
     </site>

   This sets the thread-local site manager to the named global
   service manager utility.  It resets it after processing the
   subdirectives.

- Modify the code for making a site so that it gives the option of
   picking a global site manager, rather than creating a local one.
   (If a local one is created, then maybe give the option of selecting
   which local and global ones it is based on. This is a bit tricky.
   I won't go into details unless you decide to pursue this.)

   Alternatively, you may want to try to associate site managers with
   folders in ZCML.

- WARNING: I think it's possible to configure objects in the database via
   ZCML.  (We sort of do this implicitly now, by defining startup subscribers.)
   This is *very* risky.  In my experience, mixing file-system (ZCML/Python
   module) data and persistent data causes headaches.  I think that if you
   decide to do this, it should be through startup subscribers.  This has
   worked reasonably well for us and has the advantage that you have more
   or less arbitrary code that executes every time the system starts.

Questions?

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list