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

Hedley Roos hedley at upfrontsystems.co.za
Thu Jun 11 13:09:48 UTC 2009


Andreas Jung wrote:
> 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?
> 
> Andreas
> 
>

Hi Andreas

Have you tried setting keepReferencesOnCopy=1 on the field which 
references the sub-event?

There is a chance that it will work since moving an object from a temp 
dir to its final location leads to a manage_afterAdd. See 
Archetypes/Referenceable.py.

I believe it will work since objects in portal_factory are catalogued. 
(They are removed later - can't remember how). This means there is a 
window of opportunity for the references to be maintained.

Hedley




More information about the Product-Developers mailing list