[Zope] Programmatically adding my product

Tim Hicks tim@sitefusion.co.uk
Thu, 22 Aug 2002 13:47:06 +0100


> Yes, it was helpful, in that up to now, I had not been able to
> programmatically add anything. Now can add OFS products and I'm sure
> anything else supplied with the distro.
>
> The problem is that the recipe in the cookbook did not work for my own
> ZClass based product and the reason I believe is that the ZClass derived
> product does not have a method of the form manage_addXXXX(id='yyyy').
> Always reports an attribute error. Investigating using type() and dir()
> help somewhat, but I'm no further on.

You do need a method for adding instances of your zclass.  If you don't have
one, add one, then call it like

context.manage_addProduct['YourZClass'].theNameOfYourAddingMethod(id='foo')

or something like that.

hth,

tim