Skip to content

Commit 608a276

Browse files
committed
Clean up upgrade-addons-to-50.md
1 parent f9f973d commit 608a276

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

docs/backend/upgrading/version-specific-migration/upgrade-addons-to-50.md

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@ myst:
44
"description": "Upgrading add-ons to Plone 5.0"
55
"property=og:description": "Upgrading add-ons to Plone 5.0"
66
"property=og:title": "Upgrading add-ons to Plone 5.0"
7-
"keywords": "Upgrading, Plone 5.0"
7+
"keywords": "Upgrading, Plone 5.0, add-ons"
88
---
99

1010
(upgrading-addons-to-50-label)=
1111

1212
# Upgrade a custom add-on to Plone 5.0
1313

14+
This chapter discusses how to upgrade a custom add-on to Plone 5.0.
15+
1416
## Archetypes
1517

1618
If your add-on depends on Archetypes, you will need some parts of `Products.ATContentTypes`.
17-
Those parts will be declared by the profile "Archetypes-tools without content types". It must be added to your `profiles/default/metadata.xml` that way:
19+
Those parts will be declared by the profile "Archetypes-tools without content types".
20+
It must be added to your `profiles/default/metadata.xml` that way:
1821

19-
```
22+
```xml
2023
<dependencies>
2124
<dependency>profile-Products.ATContentTypes:base</dependency>
2225
...
2326
</dependencies>
2427
```
2528

29+
2630
## JS/CSS bundle
2731

2832
Plone 5 does not use `portal_css` and `portal_javascript` anymore.
@@ -49,53 +53,56 @@ Add a file named `registry.xml` in your profile, containing:
4953
```
5054

5155
````{note}
52-
This example assumes our JS and CSS are provided as browser resources, but if they are in our old `skins` folder, that would work too:
56+
This example assumes our JavaScript and CSS are provided as browser resources, but if they are in our old `skins` folder, that would work too:
5357
54-
```
58+
```xml
5559
<value key="csscompilation">portal_skins/MyAddon/mycustom.css</value>
5660
```
5761
````
5862

63+
5964
## CSRF protection
6065

61-
Plone 5 provides a CSRF protection mechanism. This mechanism is integrated into the different Plone frameworks.
66+
Plone 5 provides a CSRF protection mechanism.
67+
This mechanism is integrated into the different Plone frameworks.
6268
If your add-on only uses default Dexterity or Archetypes features, you are safe.
6369

6470
But any custom redirection or form submission will have to include a token provided by `plone.protect`.
6571

66-
- in a template:
67-
68-
```
69-
<span tal:replace="structure context/@@authenticator/authenticator"/>
70-
```
71-
72-
- in a script:
73-
74-
```
75-
authenticator = context.restrictedTraverse("@@authenticator")
76-
url = url + "?_authenticator=" + authenticator.token()
77-
state.set(..., next_action='redirect_to:string:%s' % url)
78-
```
79-
80-
- in a method:
81-
82-
```
83-
from plone.protect.utils import addTokenToUrl
84-
url = addTokenToUrl(url)
85-
```
86-
87-
## plone.app.stagingbehavior
88-
89-
plone.app.stagingbehavior was used to enable versioning functionality for Dexterity-based content types.
72+
- In a template:
73+
74+
```xml
75+
<span tal:replace="structure context/@@authenticator/authenticator"/>
76+
```
77+
78+
- In a JavaScript:
79+
80+
```js
81+
authenticator = context.restrictedTraverse("@@authenticator")
82+
url = url + "?_authenticator=" + authenticator.token()
83+
state.set(..., next_action='redirect_to:string:%s' % url)
84+
```
85+
86+
- In a method:
87+
88+
```python
89+
from plone.protect.utils import addTokenToUrl
90+
url = addTokenToUrl(url)
91+
```
92+
93+
## `plone.app.stagingbehavior`
94+
95+
`plone.app.stagingbehavior` was used to enable versioning functionality for Dexterity-based content types.
9096
It allowed you to perform the checkout and checkin operations to work on a copy of your original content on Plone 4.
9197

92-
The version of plone.app.iterate used in Plone 5 implements this already making that package obsolete
98+
The version of `plone.app.iterate` used in Plone 5 implements this already, making that package obsolete.
99+
100+
You should remove any hard dependency on `plone.app.stagingbehavior` from your add-on to avoid issues.
93101

94-
You should remove any hard dependency on plone.app.stagingbehavior from your add-on to avoid issues.
102+
See https://github.com/collective/collective.cover/pull/577/files for an example of how to achieve that.
95103

96-
See <https://github.com/collective/collective.cover/pull/577/files> for an example on how to achieve that.
97104

98105
## Content type icons
99106

100107
A major breaking change from Plone 4.x to Plone 5 is how content type icons are handled.
101-
See :ref:content-type-icons-changed\` for details.
108+
See {ref}`content-type-icons-changed` for details.

0 commit comments

Comments
 (0)