Products.contentmigration/unpack_brains_during_migration: Unpack brains to be able to log broken catalog-records durin

Philip Bauer <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: Products.contentmigration
Branch: refs/heads/unpack_brains_during_migration
Date: 2017-07-20T13:49:39+02:00
Author: Philip Bauer (pbauer) <[email protected]>
Commit: https://github.com/plone/Products.contentmigration/commit/0b6d8f4a49dc5156f773c89e3c8e49aac2251dca

Unpack brains to be able to log broken catalog-records during migration

Files changed:
M Products/contentmigration/basemigrator/walker.py
M Products/contentmigration/walker.py

diff --git a/Products/contentmigration/basemigrator/walker.py b/Products/contentmigration/basemigrator/walker.py
index 2c32753..dbe5499 100644
--- a/Products/contentmigration/basemigrator/walker.py
+++ b/Products/contentmigration/basemigrator/walker.py
@@ -269,12 +269,18 @@ def walk(self):
         if limit:
             brains = brains[:limit]
 
+        # unpack to be able to log brains that break during migration
+        brains = [i for i in brains]
+
         for brain in brains:
             try:
                 obj = brain.getObject()
             except AttributeError:
                 LOG.error("Couldn't access %s" % brain.getPath())
                 continue
+            except KeyError:
+                LOG.error("Couldn't access RID %s" % brain.getRID())
+                continue
             try:
                 state = obj._p_changed
             except:
diff --git a/Products/contentmigration/walker.py b/Products/contentmigration/walker.py
index d94afb0..39acc0d 100644
--- a/Products/contentmigration/walker.py
+++ b/Products/contentmigration/walker.py
@@ -59,12 +59,18 @@ def walk(self):
         if limit:
             brains = brains[:limit]
 
+        # unpack to be able to log brains that break during migration
+        brains = [i for i in brains]
+
         for brain in brains:
             try:
                 obj = brain.getObject()
             except AttributeError:
                 LOG.error("Couldn't access %s" % brain.getPath())
                 continue
+            except KeyError:
+                LOG.error("Couldn't access RID %s" % brain.getRID())
+                continue
 
             if self.callBefore is not None and callable(self.callBefore):
                 if self.callBefore(obj, **self.kwargs) == False:



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