[Product-Developers] Re: Aborting deletion of objects

Maurits van Rees m.van.rees at zestsoftware.nl
Sat May 16 19:27:25 UTC 2009


Johannes Schwenk, on 2009-05-14:
> Hello all!
>
> I'm currently developing a Archetypes based product for Plone 3.1.7 (Zope 
> 2.10.6-final, python 2.4.4, linux2). 
>
> What is the best and safest way to abort object deletion and display an 
> informative message? I want to abort deletion of objects of a custom content 
> type iff it has references to other objects. The user should be redirected to 
> the base view of the object, if he tries to delete (actions menu or otherwise 
> ttw) a object with references still in place. The references are implemented 
> using the ReferenceField from Archetypes.

This sounds exactly what plone.app.linkintegrity already does in
default Plone.  Look for the link integrity option in the
site-controlpanel.

If that almost does what you want you can probably tweak things,
hopefully with just a few lines.

That package should have enough hints to get you further.  Ah,
actually, the NOTES.txt in that package is required reading, as that
explains why subscribing to IObjectWillBeRemovedEvent is apparently
not a good idea...

-- 
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