[Zope3-dev] IFactory, and composite factories
R. David Murray
bitz@bitdance.com
Sat, 31 Aug 2002 10:32:04 -0400 (EDT)
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.
> I'm not aware that composite factories can be used for anything but
> adapters and views.
OK, SteveA had it wrong then. He thought it applied anywhere there
was a factory attribute. I will correct the changes I made to the
docs.
> 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.
> 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?
> AFAIK, nobody is using this feature anymore.
> You are confused because the terminology is a little confusing.
>
> "Factory" is a pretty general term that we are using for two different
> things.
Yeah. It's appropriate in both contexts, but I'd almost rather
rename the content Factory somehow to create a separation.
--RDM