[Zope3-dev] Registering a Content Factory object

Marius Gedminas mgedmin@codeworks.lt
Thu, 10 Apr 2003 11:34:52 +0300


On Wed, Apr 09, 2003 at 07:41:29AM -0400, Stephan Richter wrote:
> On Wednesday 09 April 2003 03:24, Steve Alexander wrote:
> > Stephan Richter wrote:
> > > I use the content directive (including the factory subdirective) to
> > > define a new content object and its factory. However, now I would like to
> > > define a special Factory that will create the content object. How do I so
> > > this?
> >
> > A factory is a callable object, such as a class or a function or a class
> > method or a static method.
> 
> Right, but in the content directive I have to give the class name and it is 
> assumed that this is class name is also the factory, so I have no way to 
> specify a function as factory.

You could use the regular <factory> directive, which is not a subdirective
of <content>.  See doc/zcml/namespaces.zope.org/zope/factory.stx
I've found only one place in Zope 3 where that directive is actually
used -- src/zope/app/services/translation/configure.zcml

Marius Gedminas
-- 
Codeworks is available for Zope consulting -- http://www.codeworks.lt/