[Product-Developers] Re: Post-create update of a reference field

Maurits van Rees m.van.rees at zestsoftware.nl
Thu Jun 11 09:24:37 UTC 2009


Andreas Jung, on 2009-06-11:
>
> Hi there,
>
> following use case: an AT-Event derived content-type contains provides
> a "create sub-event" link within its default view. Clicking on the link
> will create a new event and add the new event to a referencefield within
> the original event (standard master-slave relationship). This works fine
> with invokeFactory() and updating the related fields within a browser view.
> However I want to use portal_factory in order to avoid orphan event. Any
> idea
> how to update the referencefield of the master event after the creating
> of the
> slave event through portal_factory?

Register a zope 3 event handler for the sub event type and
Products.Archetypes.interfaces.IObjectInitializedEvent

In that handler check if the parent of the object is an instance of
your AT-Event derived content-type and set the reference field.

-- 
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]





More information about the Product-Developers mailing list