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

Philipp von Weitershausen philipp at weitershausen.de
Tue Feb 6 08:35:39 EST 2007


On 6 Feb 2007, at 09:59 , Chris Withers wrote:
>>> Why named? If only so you can register many of them, then I call  
>>> yagni. Like a unix file system, a zope instance should only have  
>>> one root :-)
>> Sure. But the use of named utilities would make it a tad easier  
>> because you wouldn't need ZCML overrides.
>> Let's say Zope 3 defines an IRootObjectFactory utility called  
>> 'zope.app.appsetup'. So, a default zope.conf would look like this:
>>   # root-object-factory -- name of an IRootObjectFactory utility  
>> that the
>>   # publication will use to create the root object.
>>   #
>>   #  Default: root-object-factory zope.app.appsetup
>
> 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. zope.app.appsetup would have to instantiate  
and register such a utility if it finds a ZODB section in zope.conf,  
because the utility will have to know about the database.

The point is that this is really hard to override. Overrides only  
work within the execution of a single ZCML tree. That's why I  
suggested named utilities.

> 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.




More information about the Zope3-dev mailing list