[Zope3-dev] Re: zope.app.twisted.main?

Chris Withers chris at simplistix.co.uk
Tue Feb 6 09:41:09 EST 2007


Philipp von Weitershausen wrote:
>> Why would this be in zope.conf at all?
>> I would have thought just having a normal zcml setup for a single, 
>> global IRootObjectFactory utility would be fine...
> 
> Well, actually, you can't register it through ZCML because ZCML knows 
> nothing about the ZODB. 

Okay, how about the config parser registers the utility:

from zope.component import provideUtility
provideUtility(IRootObject,MyZODBRootThingy)

Of course, I don't see any reason for the config parser to _have_ to do 
so... something just needs to register an IRootObject before the first 
publication gets instantiated, right?

If so, what bad things could happen if the zodb sections in zope.conf 
were made optional and a later zcml statement provided the utility?

<utility factory="myIRootObjectProvider" />

>> Also, why the factory? Why not just IRootObject?
> 
> I guess just IRootObject is ok, the factory would have been a bit more 
> generic because then you're not registering a specific root object for 
> all times but could actually incorporate some logic into the 
> root-object-finding-process.

Why would you want to do that?

There should be only one root, if it then wants to do interesting 
things, then either it can, or traversal adapters that start with it 
can. Why would you want any more complexity?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope3-dev mailing list