Skip to content

Commit

Permalink
Re-launch 5800 upgrade-step for already created folders because there…
Browse files Browse the repository at this point in the history
… were some missing ids.
  • Loading branch information
cekk committed Nov 25, 2024
1 parent 03b284d commit e5a98ca
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
5.1.17 (unreleased)
-------------------

- Nothing changed yet.
- Re-launch 5800 upgrade-step for already created folders because there were some missing ids.
[cekk]


5.1.16 (2024-09-20)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<metadata>
<version>5800</version>
<version>5900</version>
<dependencies>
<dependency>profile-redturtle.bandi:default</dependency>
<dependency>profile-collective.venue:default</dependency>
Expand Down
10 changes: 10 additions & 0 deletions src/design/plone/contenttypes/upgrades/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,14 @@
handler=".upgrades.to_5800"
/>
</genericsetup:upgradeSteps>
<genericsetup:upgradeSteps
profile="design.plone.contenttypes:default"
source="5800"
destination="5900"
>
<genericsetup:upgradeStep
title="Reindex exclude_from_search for missing folders"
handler=".upgrades.to_5900"
/>
</genericsetup:upgradeSteps>
</configure>
17 changes: 17 additions & 0 deletions src/design/plone/contenttypes/upgrades/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,3 +1068,20 @@ def to_5800(context):

catalog = api.portal.get_tool(name="portal_catalog")
catalog.manage_reindexIndex(ids=["exclude_from_search"])


def to_5900(context):
"""
Re-launch 5800 upgrade to already created folders, because there were some missing ids
"""
for id, pt in [
("sponsor_evento", "Document"),
("documenti", "Document"),
("documenti-allegati", "Document"),
("modulistica", "Document"),
]: # ...
brains = api.content.find(getId=id, portal_type=pt)
for brain in brains:
obj = brain.getObject()
obj.exclude_from_search = True
obj.reindexObject(idxs=["exclude_from_search"])

0 comments on commit e5a98ca

Please sign in to comment.