4teamwork/ftw.publisher.sender — pull request #7 by jone (2013-02-20 16:05:58+00:00)
Title: Integrity check issues when creating delete jobs with IObjectRemovedEvent

In integration packages we often subscribe a `IObjectRemovedEvent` event handler, calling the `publisher.delete` view when necessary. This caused issues with the integrity check.

**Situation**

When visiting delete_confirmation (not yet confirmed) the `Products.CMFPlone.utils.isLinked` function makes an integrity check by deleting the content in a savepoint, which is rolled back later.

This caused the "object was deleted" status message to appear when just visiting the confirmation page and also when canceling, but it should only appear when actually clicking "Delete" (although the Delete-Job is rolled back correctly).

For addressing this issue I've made a `add_transaction_aware_status_message` which only adds the status message after committing to the ZODB and only if the committed transaction did not have savepoints at the time `publisher.delete` was executed which were rolled back afterwards (which is usually only the case when within link integrity check).

This Fixes 4teamwork/ftw.publisher.sender#6 in a less integrity-check-centric way so that the delete view is still generic.

/cc @maethu