[Grok-dev] multiple grok wsgi applications possible?

Chris McDonough chrism at plope.com
Wed Dec 17 16:06:28 EST 2008

Brandon Craig Rhodes wrote:
> Chris McDonough <chrism at plope.com> writes:
>> I fear that any code that uses getGlobalSiteManager (read: lots of
>> stuff) as opposed to more generally written code that uses
>> getSiteManager is doomed to obtain the actual single global ZCML
>> registry unless zope.component is modified.
> I'd assumed you were just overwriting
> `zope.component.globalregistry.globalSiteManager` with whatever each
> threaded "needs to see" to work properly.

Yes, during initial registry population (e.g. xmlconfig.include(...)) this is
exactly what we do.

The code I fear isn't the code executed during registry population. it's the
code sitting around that assumes it can use getGlobalSiteManager to do
adaptation that is executed at application runtime.  I really have no idea how
much of this there is, maybe less than I fear.

>  From what you're saying, I
> guess I'm to assume you're instead trying to "play by the rules" and not
> touch its module-global variables to force it to play multi-threaded?

No, no magic here.  In apps written for bfg, it's just an unwritten rule that
runtime code should never use getGlobalSiteManager (always getSiteManager), and
that ZCML handlers shouldn't try to mutate any state outside the registry.

- C

More information about the Grok-dev mailing list