[Zope-CMF] addProduct vs init. Need explanations

Florent Guillaume fg@nuxeo.com
Tue, 5 Nov 2002 17:21:07 +0000 (UTC)


Pascal Samuzeau  <samuzeau@oreka.com> wrote:
> Hi,
>
> If I have a product's python source, I've something as:
>
> from ....
>
> factory....
>
> def addProductA(...)
> ...
>
> class ProductA(..)
>
> ...
>
>    def init(..)
>      ....
>
> InitializeClass(ProductA)
>
>
> Ok, But What addProductA for ?
>
> I mean if I add a ProductA under a CMFSite, only the init'class is
> calling.
>
> I can write what I want in addProductA, nothing happens.
>
> So, I think I haven't yet really understand what addProductA is done.
>
> Cheers
> PS

addProductA has to be specified as the 'factory' in the
factory_type_information, and also as a contentConstructor in
__init__.py.

It will then be called by the normal CMF content creation process, which
is to call invokeFactory in the container where the object is to be
created (or using the Types Tool directly). If you create the content
object in any other way then it won't have proper CMF behavior.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com