[Zope] Again: manage_afterAdd

Pavlos Christoforou pavlos@gaaros.com
Mon, 28 Feb 2000 17:59:20 -0500 (EST)


Hi Tom,

I have not followed the thread so might be talking nonsense ... but today
I am in the mood for talking nonsense anyway ...

On Mon, 28 Feb 2000, Tom Deprez wrote:

> >> I've a class with a property myparent
> >> This property needs to be set after a new instance is added or when the
> >> instance is moved.


The way I would do it is in your products add method, say if your ZClass
is named SuperDeprezClass then the method should be SuperDeprezClass_add.

in there you can add:

 <dtml-call "propertysheets.<propertysheet name>.manage_editProperties(
                  REQUEST)">

assuming your property sheet defines a property myparent and it is
available
in the REQUEST (in the form for example) object then it should be added at
creation time.

> >> Thanks to people from the list, I know I've to make an external method and
> >> add the external method manage_afterAdd to the methods of the class.
> >>
> >> This is how the method looks:


This one  have not tried before but something along these lines might
work:

def manage_afterAdd(self,item,container): 
	item.manage_changeProperties({'parent':container.id})


All untested but hopefully helpful

Pavlos