[Zope] context / addProduct question

Dieter Maurer dieter at handshake.de
Tue Jan 13 13:36:58 EST 2004


Jeremiah White wrote at 2004-1-13 10:48 -0500:
> ...
>Within the folder “scripts” I have a python script (myAddFolder) with the
>following code:
>context.manage_addProduct['OFSP'].manage_addFolder(sub_id, sub_title)
> 
>I am calling that script from a form.  If I call it from a page within
>Sub-folder1, for example, the action would be “scripts/myAddFolder”.  I
>would like it to then add a folder inside Sub-folder1.  I understand why it
>will actually add it within the “scripts” folder, but I don’t know how to
>get around this.

The easiest way would be to give your "myAddFolder" an
additional parameter "destination = None" and use as code:

	   if destination is None: destination = context
	   destination.manage_addProduct....

This way, you can explicitely determine the destination
(by passing it as parameter).

-- 
Dieter



More information about the Zope mailing list