Skip to content

Commit

Permalink
Preserve order of behaviors during installation
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Aug 15, 2022
1 parent 27352f0 commit 5d81fb5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions news/403.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix installation to preserve existing order of behaviors. [davisagli]
6 changes: 3 additions & 3 deletions src/plone/app/multilingual/browser/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,6 @@ def ensure_translatable(self, type_):

if IDexterityFTI.providedBy(fti):
behaviors = list(fti.behaviors)
behaviors.append("plone.translatable")
behaviors = tuple(set(behaviors))
fti._updateProperty("behaviors", behaviors)
if "plone.translatable" not in behaviors:
behaviors.append("plone.translatable")
fti._updateProperty("behaviors", tuple(behaviors))
12 changes: 4 additions & 8 deletions src/plone/app/multilingual/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,10 @@ def enable_translatable_behavior(portal):
)
for fti in dx_ftis:
# Enable translatable behavior for all types
behaviors = list(fti.behaviors)
behaviors.extend(
[
"plone.translatable",
]
)
behaviors = tuple(set(behaviors))
fti._updateProperty("behaviors", behaviors)
if "plone.translatable" not in fti.behaviors:
behaviors = list(fti.behaviors)
behaviors.append("plone.translatable")
fti._updateProperty("behaviors", tuple(behaviors))


def step_uninstall_various(context):
Expand Down

0 comments on commit 5d81fb5

Please sign in to comment.