-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from euphorie/scrum-2640-mailing-lists-index
Index managerRolesAndUsers on the object itself
- Loading branch information
Showing
4 changed files
with
47 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
25 changes: 25 additions & 0 deletions
25
src/osha/oira/upgrade/v1/20240916134747_reindex_manager_roles/upgrade.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from ftw.upgrade import UpgradeStep | ||
from plone import api | ||
|
||
import logging | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class ReindexManagerRoles(UpgradeStep): | ||
"""Reindex manager roles.""" | ||
|
||
def __call__(self): | ||
self.install_upgrade_profile() | ||
sectors = api.portal.get().sectors | ||
client = api.portal.get().client | ||
for context in [sectors, client]: | ||
for brain in api.content.find(context=context, depth=3): | ||
try: | ||
obj = brain.getObject() | ||
except KeyError: | ||
logger.info("Could not get object %s", brain.getPath()) | ||
continue | ||
if hasattr(obj, "reindexObject"): | ||
obj.reindexObject(idxs=["managerRolesAndUsers"]) |