plone.app.linkintegrity/master: Do not fail on invalid objects in referenec_catalog. Fixes #

Philip Bauer <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.app.linkintegrity
Branch: refs/heads/master
Date: 2017-06-20T15:19:02+02:00
Author: Philip Bauer (pbauer) <[email protected]>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/d6cbc67bff0e2fc7344899679266cd053a3ce29e

Do not fail on invalid objects in referenec_catalog. Fixes #32 and #48

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/upgrades.py

diff --git a/CHANGES.rst b/CHANGES.rst
index e2cc5fa..2a0912a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,8 @@ New features:
 
 Bug fixes:
 
-- *add item here*
+- Do not fail on invalid objects in referenec_catalog. Fixes #32 and #48
+  [pbauer]
 
 
 3.3.1 (2017-06-01)
diff --git a/plone/app/linkintegrity/upgrades.py b/plone/app/linkintegrity/upgrades.py
index 56d47bf..3bd44c5 100644
--- a/plone/app/linkintegrity/upgrades.py
+++ b/plone/app/linkintegrity/upgrades.py
@@ -17,6 +17,9 @@ def migrate_linkintegrity_relations(context):
                 continue
             source_obj = uuidToObject(brain.sourceUID)
             target_obj = uuidToObject(brain.targetUID)
+            if source_obj is None or target_obj is None:
+                # reference_catalog my be inconsistent
+                continue
             # Delete old reference
             reference_catalog.deleteReference(
                 source_obj, target_obj, relationship=referencedRelationship)



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.