Op 16-06-11 15:58, Andreas Jung schreef:
Giacomo Spettoli wrote:

Hi,
    you could disable "link-integrity" check via python before using
manage_delObjects and re-enable after job's done.

How would you do that? Afaik: the integrity checker is integrated
as an event subscriber. In Produce&  Publish I am using the deletion
API heavily for moving stuff around. Perhaps I should disable the
integrity checks in general for such sites...causing more problems than
it actually solves.

I have this in some client code in an import script that removes all contents from a folder, before adding new contents (which are expected to be mostly the same):


from plone.app.linkintegrity.exceptions import \
    LinkIntegrityNotificationException

for oid in target_folder.contentIds():
    try:
        target_folder._delObject(oid)
    except LinkIntegrityNotificationException:
        # Despite the exception, this item has been removed
        # anyway...
        logger.warn("Possible link integrity problems for %s", oid)


It has been a while ago since I (or a colleague) wrote this code, but I think the idea is that without the try/except the exception would cause the transaction to be aborted (so the object would remain in the database) and would redirect to tje deletion confimation screen. With the try/except in place the object stays deleted and no redirection takes place.



--
Maurits van Rees
Web App Programmer at Zest Software: http://zestsoftware.nl
Personal website: http://maurits.vanrees.org/

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to