[Zope] Adding Z Class instances from code (was: ZClass and Permissions)

douwe@oberon.nl douwe@oberon.nl
Mon, 24 Jun 2002 14:30:00 +0200


> If your ZClass is independent of non-Core products, you can may
> an export and send it to me.
>
> I will try to figure out why you cannot add properties.
>

Hi,

Thanks for the offer. My ZClass is dependent not so much on non-Core
stuff as well as on other ZClass'es. I'll just start over with a
fresh class, implementing the basic things that went wrong and changes
are that everything will work and if not, I'll post it.

Meanwhile, during my new setup I started to wonder what the best way
is to add instances of Z Class programmatically. There is a HOW-TO on
this subject, but that seems to require either the usage of DTML, or
an external method.

I always use the following code:
obj=context.manage_addProduct['test'].testDoc.createInObjectManager('newId',
request)

Is this correct? I sometimes get an error that I don't have access rights to
testDoc?

if it is correct, maybe this should be added to the howto, it seems more
clean.

Douwe