[Zope] Re: Adding Z Class instances from code (was: ZClass and Permissions)
Dieter Maurer
dieter@handshake.de
Mon, 24 Jun 2002 21:52:58 +0200
douwe@oberon.nl writes:
> ...
> 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?
Looks good!
> I sometimes get an error that I don't have access rights to
> testDoc?
I know that when the acquisition chain is broken, usually because
a DTML object is called without its positional arguments.
The code above gives no hint towards this, though.
> if it is correct, maybe this should be added to the howto, it seems more
> clean.
Go ahead...
Dieter