Skip to content

Commit

Permalink
add seo behavior to file
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Nov 4, 2024
1 parent 97baeab commit 3bb4a03
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
6.2.23 (unreleased)
-------------------

- Nothing changed yet.
- add SEO behavior to File
[mamico]


6.2.22 (2024-10-30)
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>7308</version>
<version>7309</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/profiles/default/types/File.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Dexterity FTI"
name="File"
i18n:domain="plone"
>
<property name="behaviors" purge="False">
<element value="kitconcept.seo" />
</property>
</object>
7 changes: 7 additions & 0 deletions src/design/plone/contenttypes/upgrades/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -912,4 +912,11 @@
destination="7308"
handler=".to_730x.to_7308"
/>
<genericsetup:upgradeStep
title="add kitconcept.seo to File"
profile="design.plone.contenttypes:default"
source="7308"
destination="7309"
handler=".to_730x.to_7309"
/>
</configure>
13 changes: 13 additions & 0 deletions src/design/plone/contenttypes/upgrades/to_730x.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,16 @@ def to_7308(context):
if i % 15 == 0:
logger.info("Progress: {}/{}".format(i, tot))
brain.getObject().reindexObject(idxs=["effectivestart"])


def to_7309(context):
logger.info("Enable kitconcept.seo behavior to File")
portal_types = api.portal.get_tool(name="portal_types")
behavior = "kitconcept.seo"
for ct in ["File"]:
portal_type = portal_types.get(ct, None)
if portal_type:
behaviors = list(portal_type.behaviors)
if behavior not in behaviors:
behaviors.append(behavior)
portal_type.behaviors = tuple(behaviors)

0 comments on commit 3bb4a03

Please sign in to comment.