[Zope] ObjectManager and product instantiation

Max M maxm@mxm.dk
Wed, 03 Jul 2002 11:09:50 +0200


Sylvain Th=E9nault wrote:

>I wish to know if there is another way than
>
>self.manage_addProduct['OFSP'].manage_addNiceProduct(id)
>
>to add a product to an object which inherits from ObjectManager ?
>My problem is that I would like to create the object first and add it
>latter to the object manager. Idea ?
> =20
>

If it is a Python based product you can just import the product in the=20
normal fashion and then instanciate it. Ie. from an external script.

from NiceProduct import NiceProduct

id =3D 'niceId'
niceProduct =3D NiceProduct(id)
niceProduct.title =3D 'Nice Title'
self.someFolder._setObject(id, theClass(niceProduct))

regards Max M