Skip to content

Commit

Permalink
added upgrade step
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-andreotti committed Mar 28, 2024
1 parent c72c507 commit 7380e13
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion redturtle/bandi/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<metadata>
<version>2101</version>
<version>2102</version>
</metadata>
16 changes: 16 additions & 0 deletions redturtle/bandi/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,19 @@ def migrate_to_2101(context):
)
bando = brain.getObject()
bando.reindexObject(idxs=['scadenza_bando'])


def migrate_to_2102(context):
update_catalog(context)

bandi = api.content.find(portal_type="Bando")
tot_results = len(bandi)
logger.info("### Fixing {tot} Bandi ###".format(tot=tot_results))
for counter, brain in enumerate(bandi):
logger.info(
"[{counter}/{tot}] - {bando}".format(
counter=counter + 1, tot=tot_results, bando=brain.getPath()
)
)
bando = brain.getObject()
bando.reindexObject()
8 changes: 8 additions & 0 deletions redturtle/bandi/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,12 @@
handler=".upgrades.migrate_to_2101"
profile="redturtle.bandi:default" />

<gs:upgradeStep
title="Add new metadata for tipologia_bando_label"
description=""
source="2101"
destination="2102"
handler=".upgrades.migrate_to_2102"
profile="redturtle.bandi:default" />

</configure>

0 comments on commit 7380e13

Please sign in to comment.