Skip to content

Commit

Permalink
Updated upgrade step to 2103 (`Add 'last_updated' to categorized_elem…
Browse files Browse the repository at this point in the history
…ents`), do not stop in case we found a `last_updated` key in `categorized_elements` of an element but continue to next element, maybe some elements were updated by another part of code.
  • Loading branch information
gbastien committed Mar 10, 2022
1 parent 5b3ad73 commit 721c3bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 5 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ Changelog
0.51 (unreleased)
-----------------

- Nothing changed yet.

- Updated upgrade step to 2103 (`Add 'last_updated' to categorized_elements`),
do not stop in case we found a `last_updated` key in `categorized_elements`
of an element but continue to next element, maybe some elements were updated
by another part of code.
[gbastien]

0.50 (2022-01-03)
-----------------
Expand Down
5 changes: 2 additions & 3 deletions src/collective/iconifiedcategory/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def upgrade_to_2103(context):
'''The element "last_updated" is now in categorized_elements.'''
catalog = api.portal.get_tool('portal_catalog')

# compute "modified" for categorized elements
# compute "last_updated" for categorized elements
brains = catalog(
object_provides='collective.iconifiedcategory.'
'behaviors.iconifiedcategorization.IIconifiedCategorizationMarker')
Expand All @@ -148,8 +148,7 @@ def upgrade_to_2103(context):
modified._timezone_naive = True
if 'last_updated' in parent.categorized_elements[obj.UID()]:
# already upgraded
pghandler.info('STOPPING, already migrated...')
break
continue
parent.categorized_elements[obj.UID()]['last_updated'] = modified.asdatetime()
parent._p_changed = True
pghandler.finish()
2 changes: 1 addition & 1 deletion src/collective/iconifiedcategory/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
profile="collective.iconifiedcategory:default" />

<genericsetup:upgradeStep
title="Add 'modified' to categorized_elements"
title="Add 'last_updated' to categorized_elements"
description=""
source="2102"
destination="2103"
Expand Down

0 comments on commit 721c3bf

Please sign in to comment.