[Zope3-dev] IFactory, and composite factories

Jim Fulton jim@zope.com
Sun, 01 Sep 2002 07:11:26 -0400


R. David Murray wrote:
> On Sat, 31 Aug 2002, Jim Fulton wrote:
> 
>>R. David Murray wrote:
>>
>>>A composite factory looks like:
>>>	c(b(a(context)))
>>>
>>This is when you have:
>>   factory="a b c"
>>
> 
> Right.  That's how I documented it.
> 
> 
>>Note that even for a view, all but the last factory in list
>>must be adapters (e.g. "a" and "b" in the example).
>>
> 
> Ah!!  Enlightenment strikes.  OK, I will fix the documentation,
> unless this is a feature that is going to get deleted.

<shrug>

...

>>The factory attribute in ZCML is for creating other kinds of components.
>>Adapter factories take a single argument. Resource factories take a
>>single argument (the request). View factories take two arguments, context,
>>and request. Utility and service factories take no arguments.
>>
> 
> And I think I should include this info as well.

Yes.


> 
>>We really don't bother with interfaces for the factories names
>>in the ZCML factory attributes, because these factories are not
>>components.
>>
> 
> Well, there's an IViewFactory interface, and that is certainly helpful
> from a documentation point of view if nothing else.  Would there be
> any object to my creating such Interfaces just for documentation
> purposes?

No, but you might note that we don't currently require that the objects
pointed to by the factory attribute actually assert that they implement
the interfaces. These are almost always classes and asserting interfaces
for classes is a bit messy.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org