[Zope3-dev] Registering a Content Factory object

Steve Alexander steve@cat-box.net
Wed, 09 Apr 2003 09:24:32 +0200


Stephan Richter wrote:
> Hi all,
> 
> 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.


> Why do I need this? I would like to add other content objects in the generated 
> content object, i.e. change the default behavior of adding a container 
> object.

I think you'll want to write a factory that creates a Folder and marks 
the new Folder instance with a marker interface before returning it.

Alternatively, perhaps you can use the "chained series of factories" 
feature to use the existing Folder factory, and put after it your 
factory that will mark the folder with an interface.

--
Steve Alexander