Skip to content

Commit

Permalink
Merge pull request #58 from fgrcon/master
Browse files Browse the repository at this point in the history
add upgrade for get_icon
  • Loading branch information
jensens committed Nov 13, 2015
2 parents 5cf3942 + 1c20eaf commit 42fa8fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Changelog

New:

- extended step to501 with reindexing getIcon (#1226)
[fgrcon]

- Removed fake kupu tool and related settings and resources.
[maurits]

Expand Down
18 changes: 18 additions & 0 deletions plone/app/upgrade/v50/final.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from plone.app.upgrade.utils import loadMigrationProfile
from plone.dexterity.interfaces import IDexterityContent
from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode
Expand Down Expand Up @@ -39,3 +40,20 @@ def _migrate_list(original_id, new_id=None):
def to501(context):
"""5.0 -> 5.0.1"""
loadMigrationProfile(context, 'profile-plone.app.upgrade.v50:to501')

def reindex_getIcon(context):
"""
get_icon redefined: now boolean:
true if dexterity item is image or has image field (named 'image') e.g. leadimage
see https://github.com/plone/Products.CMFPlone/issues/1226
"""
catalog = getToolByName(context, 'portal_catalog')
search = catalog.unrestrictedSearchResults
cnt=0
iface = "plone.dexterity.interfaces.IDexterityContent"
for brain in search(object_provides=iface):
brain._unrestrictedGetObject().reindexObject(idxs=['getIcon'])
cnt += 1
logger.info('Reindexed `getIcon` for %s dexterity items' % str(cnt))

reindex_getIcon(context)

0 comments on commit 42fa8fd

Please sign in to comment.