Skip to content

Commit

Permalink
URB-2828: Remove covid from optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbiscuit authored and mpeeters committed Dec 18, 2023
1 parent 6017520 commit 7762725
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/URB-2828.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove covid from optional field
[jchandelle]
13 changes: 13 additions & 0 deletions src/Products/urban/migration/update_260.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,17 @@ def fix_opinion_workflow(context):
logger.info("starting upgrade steps")
setup_tool = api.portal.get_tool('portal_setup')
setup_tool.runImportStepFromProfile('profile-Products.urban:preinstall', 'workflow')


def remove_covid_from_optional_field(context):
logger = logging.getLogger('urban: Remove covid from optional field')
logger.info("starting upgrade steps")
portal_urban = api.portal.get_tool('portal_urban')
for licence_config in portal_urban.get_all_licence_configs():
used_attributes = licence_config.getUsedAttributes()
if 'covid' not in used_attributes:
continue
licence_config.setUsedAttributes(
tuple(attr for attr in used_attributes if attr != 'covid')
)
logger.info("upgrade step done!")
8 changes: 8 additions & 0 deletions src/Products/urban/migration/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -507,4 +507,12 @@
handler=".update_260.fix_opinion_workflow"
profile="Products.urban:default" />

<gs:upgradeStep
title="Remove covid from optional field"
description="Remove covid from optional field"
source="1134"
destination="1135"
handler=".update_260.remove_covid_from_optional_field"
profile="Products.urban:default" />

</configure>
2 changes: 1 addition & 1 deletion src/Products/urban/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>1134</version>
<version>1135</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down

0 comments on commit 7762725

Please sign in to comment.