Hi Hanno 

> Betreff: Re: [Zope-dev] zope.component.zcml and global registry
> On Wed, Mar 3, 2010 at 11:12 AM, Roger <d...@projekt01.ch> wrote:
> > I like to use getGlobalSiteManager by default because this doesn't 
> > force a database access and load the local site manager if 
> the site is 
> > a local site.
> The database access only happens if a local site is set into 
> the corresponding thread local. But such a site is only set 
> up when traversing over the application root via some events.
> At the point in the startup process when ZCML is processed, 
> there's no traversal events setup that could cause this and 
> nothing should open the database connection and traverse over 
> it either.
> So +1 on using getSiteManager instead of getGlobalSiteManager.

We use a different site setup. In our app the DB root "Application"
is the only site. This means if the zope "Application" get traversed
my (local) site get traversed.

I'm not sure at what time the event will set the site hooks. The worst
thing what could happen that the changes in getGlobalSiteManager will
add the configuration to the local site.

btw, we do something like this in a bootstrap subscriber:

def bootstrapXPOSite(event):
    """Subscriber to the IDataBaseOpenedEvent

    Setup a site as root Application
    db, connection, root, root_folder = getInformationFromEvent(event)

    if root_folder is None:
        # create
        import bla.bla
        root_folder = bla.bla.Site(u'The only site')

        # add as Application root
        root[ZopePublication.root_name] = root_folder

        # commit site to DB



If all kind of configuration directive processing is 
done before any kind of DB root access and relevant 
event handling (e.g. site hook setup) this seems
fine to me. If not, then we run into troubles with
the changes.

Roger Ineichen

> Hanno

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to