[Zope] Again: manage_afterAdd

Rik Hoekstra rik.hoekstra@inghist.nl
Mon, 28 Feb 2000 21:42:46 +0100


-----Oorspronkelijk bericht-----
Van: Tom Deprez <tom.deprez@uz.kuleuven.ac.be>
Aan: Kevin Dangoor <kid@kendermedia.com>; zope@zope.org <zope@zope.org>
Datum: maandag 28 februari 2000 19:08
Onderwerp: Re: [Zope] Again: manage_afterAdd


>> 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.
>>
>> 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:
>>
>> def manage_afterAdd(self,item,container):
>>     item.myparent=container.id
>>     return
>
>This is a ZClass, right?
>
>It should be:
>
>   item.propertysheets.YourPropsheet.manage_changeProperties({'myparent' :
>container.id})
>
>Kevin

Yes, it's a ZClass with in it's method's tab an external method called :
'manage_afterAdd'

The external method itself is python code (see source above)

The intention of this method is that it sets the  'myparent' property to a
value (dependend on its parent) when an instance of the ZClass is created
or when the instance is moved.

The problem is that nothing happens! 'myparent' property keeps empty. I
also don't get an error value...

What do you mean by keeps empty. Is that in the sense of:

<dtml-var myparent> does not yield a (the right) value?

or in the sense of: I can't see the value of the property in the property
screen of the instance. That last thing may happen, and still the property
may be set. Try using the dtml-var in the view method of you ZClass. If you
want the property to show if you consult the property tab, you may have to
remap the manage_Properties (or whatever it's) called view in the ZClass
definition.

Rik