plone.app.upgrade/master: fixes #84 - bug while migration, aq_base function works

"Jens W. Klein" <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.app.upgrade
Branch: refs/heads/master
Date: 2017-07-19T15:03:30+02:00
Author: Jens W. Klein (jensens) <jk-jUMamYRpa/IasaSY4/nUZ7NldLUNz+W/@public.gmane.org>
Commit: https://github.com/plone/plone.app.upgrade/commit/9f99dae94cf966b70c57175b7b69d8b1fc544ba5

fixes #84 - bug while migration, aq_base function works

Files changed:
M CHANGES.rst
M plone/app/upgrade/v50/final.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 9785daa..266a629 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,7 +15,8 @@ New features:
 
 Bug fixes:
 
-- *add item here*
+- Fix #84 - usage of aq_base
+  [jensens]
 
 
 2.0.5 (2017-07-03)
diff --git a/plone/app/upgrade/v50/final.py b/plone/app/upgrade/v50/final.py
index 57a6478..0f4b44a 100644
--- a/plone/app/upgrade/v50/final.py
+++ b/plone/app/upgrade/v50/final.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+from Acquisition import aq_base
 from plone.app.upgrade.utils import loadMigrationProfile
 from plone.registry.interfaces import IRegistry
 from Products.CMFCore.utils import getToolByName
@@ -70,7 +71,7 @@ def refresh_getIcon_catalog_metadata(context):
         for brain in zcatalog.unrestrictedSearchResults():
             # First get the new value
             obj = brain._unrestrictedGetObject()
-            new_value = bool(getattr(obj.aq_base, 'image', False))
+            new_value = bool(getattr(aq_base(obj), 'image', False))
 
             # We can now update the record with the new getIcon value
             record = list(catalog.data[brain.getRID()])



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