Skip to content

Commit 288e576

Browse files
committed
Clean up code samples, add myst meta information
1 parent 21cddae commit 288e576

File tree

1 file changed

+61
-50
lines changed

1 file changed

+61
-50
lines changed

docs/backend/upgrading/version-specific-migration/p4x-to-p5x-upgrade.md

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
# Upgrading Plone 4.x To 5.0
1+
---
2+
myst:
3+
html_meta:
4+
"description": "Upgrading Plone 4.x To 5.0"
5+
"property=og:description": "Upgrading Plone 4.x To 5.0"
6+
"property=og:title": "Upgrading Plone 4.x To 5.0"
7+
"keywords": "Upgrading, version, Plone, migration, 4.x, 5.0"
8+
---
29

3-
```{admonition} Description
4-
Instructions and tips for upgrading to a newer Plone version.
5-
```
10+
(upgrading-plone-4.x-to-5.0)=
611

7-
```{note}
8-
If you want to upgrade add-ons to Plone 5, also see {ref}`upgrading-addons-to-50-label`
12+
# Upgrading Plone 4.x to 5.0
13+
14+
This chapter provides instructions and tips for upgrading Plone 4.x to 5.0.
15+
16+
```{seealso}
17+
To upgrade add-ons to Plone 5, see also {doc}`upgrade-addons-to-50`.
918
```
1019

1120
## General Information
@@ -244,7 +253,7 @@ An old style Resource Registry would look like this:
244253
To migrate this to Plone 5, resource registrations are all done in the
245254
[Configuration Registry](https://pypi.python.org/pypi/plone.app.registry).
246255

247-
#### New Style With registry.xml
256+
#### New Style With {file}`registry.xml`
248257

249258
The new registration will look something like:
250259

@@ -271,7 +280,7 @@ A bundle defines a set of resources that should be compiled together and distrib
271280

272281
You either need to add your resource to an existing bundle or create your own bundle.
273282

274-
In this post, we'll describe the process of creating your own bundle. Again, we use registry.xml for configuration:
283+
In this post, we'll describe the process of creating your own bundle. Again, we use {file}`registry.xml` for configuration:
275284

276285
```xml
277286
<records prefix="plone.bundles/foobar"
@@ -325,9 +334,9 @@ require([
325334
'pat-registry'
326335
], function($, Registry) {
327336
'use strict';
328-
...
337+
// ...
329338
// All my previous JavaScript file code here
330-
...
339+
// ...
331340
});
332341
```
333342

@@ -395,7 +404,7 @@ If you have a resource that needs to be conditionally included, it will likely n
395404
## Control Panel
396405

397406
In Plone 4.x, the Plone configuration settings have been stored as portal properties spread across the Management Interface.
398-
In Plone 5, those settings are all stored as plone.app.registry entries in registry.xml.
407+
In Plone 5, those settings are all stored as plone.app.registry entries in {file}`registry.xml`.
399408

400409
There are now sections in the control panel, this can be set from the controlpanel.xml.
401410
See the current definitions for more information.
@@ -433,7 +442,7 @@ ptools.site_properties.available editors
433442

434443
Now you can access the property via get_registry_record()
435444

436-
```python
445+
```pycon
437446
>>> from plone import api
438447
>>> api.portal.get_registry_record('plone.available_editors')
439448
```
@@ -590,7 +599,7 @@ If you want to disable_folder_sections, you will want to set `plone.generate_tab
590599

591600
### Generic Setup
592601

593-
All settings for control panels are stored in the registry.xml Generic Setup file.
602+
All settings for control panels are stored in the {file}`registry.xml` Generic Setup file.
594603
This file can be exported through the Management Interface.
595604

596605
Go to the Plone Site Setup, choose {guilabel}`Management Interface` from the "Advanced" section.
@@ -599,7 +608,7 @@ Go to the "export" tab.
599608
Choose the {guilabel}`Export the configuration registry schemata` check-box and
600609
click the {guilabel}`Export selected steps` button.
601610

602-
The registry.xml file will contain entries like this
611+
The {file}`registry.xml` file will contain entries like the following:
603612

604613
```xml
605614
<record name="plone.available_editors"
@@ -617,7 +626,7 @@ The registry.xml file will contain entries like this
617626
</record>
618627
```
619628

620-
Drop the settings you want to change into registry.xml in you Generic Setup profile folder.
629+
Drop the settings you want to change into {file}`registry.xml` in you Generic Setup profile folder.
621630

622631
Re-install your add-on product and the settings will be available.
623632

@@ -627,7 +636,7 @@ All Generic Setup settings can be looked up with Python code.
627636

628637
First we lookup the registry utility
629638

630-
```python
639+
```pycon
631640
>>> from zope.component import getUtility
632641
>>> from plone.registry.interfaces import IRegistry
633642
>>> registry = getUtility(IRegistry)
@@ -636,27 +645,27 @@ First we lookup the registry utility
636645
Now we use the schema 'ISearchSchema' to lookup for a RecordProxy object with
637646
all fields
638647

639-
```python
648+
```pycon
640649
>>> from Products.CMFPlone.interfaces import ISearchSchema
641650
>>> search_settings = registry.forInterface(ISearchSchema, prefix='plone')
642651
```
643652

644653
Now we an get and set all fields of the schema above like
645654

646-
```python
655+
```pycon
647656
>>> search_settings.enable_livesearch
648657
True
649658
```
650659

651660
If you want to change a setting, change the attribute
652661

653-
```python
662+
```pycon
654663
>>> search_settings.enable_livesearch = False
655664
```
656665

657666
Now the enable_livesearch should disabled
658667

659-
```python
668+
```pycon
660669
>>> search_settings.enable_livesearch
661670
False
662671
```
@@ -665,9 +674,9 @@ False
665674

666675
Plone 5.x
667676

668-
```python
669-
>>> from Products.CMFPlone.interfaces import IEditingSchema
670-
>>> editing_settings = registry.forInterface(IEditingSchema, prefix='plone')
677+
```pycon
678+
>>> from Products.CMFPlone.interfaces import IEditingSchema
679+
>>> editing_settings = registry.forInterface(IEditingSchema, prefix='plone')
671680

672681
>>> editing_settings.default_editor
673682
u'TinyMCE'
@@ -729,7 +738,7 @@ The new attributes can be accessed via plone.api as described above.
729738

730739
Plone 5.x
731740

732-
```python
741+
```pycon
733742
>>> from Products.CMFPlone.interfaces import ILanguageSchema
734743
>>> language_settings = registry.forInterface(ILanguageSchema, prefix='plone')
735744

@@ -772,7 +781,7 @@ The new attributes can be accessed via plone.api as described above.
772781

773782
Plone 5.x
774783

775-
```python
784+
```pycon
776785
>>> from Products.CMFPlone.interfaces import IMaintenanceSchema
777786
>>> maintenance_settings = registry.forInterface(IMaintenanceSchema, prefix='plone')
778787

@@ -784,7 +793,7 @@ Plone 5.x
784793

785794
Plone 5.x
786795

787-
```python
796+
```pycon
788797
>>> from Products.CMFPlone.interfaces import INavigationSchema
789798
>>> navigation_settings = registry.forInterface(INavigationSchema, prefix='plone')
790799

@@ -811,7 +820,7 @@ True
811820

812821
Plone 5.x
813822

814-
```python
823+
```pycon
815824
>>> from Products.CMFPlone.interfaces import ISearchSchema
816825
>>> search_settings = registry.forInterface(ISearchSchema, prefix='plone')
817826

@@ -826,23 +835,23 @@ False
826835

827836
Plone 4.x
828837

829-
```python
830-
>>> portal = getSite()
831-
>>> portal_properties = getToolByName(portal, "portal_properties")
832-
>>> site_properties = portal_properties.site_properties
838+
```pycon
839+
>>> portal = getSite()
840+
>>> portal_properties = getToolByName(portal, "portal_properties")
841+
>>> site_properties = portal_properties.site_properties
833842

834843
>>> portal.site_title = settings.site_title
835-
>>> portal.site_description = settings.site_description
836-
>>> site_properties.enable_sitemap = settings.enable_sitemap
837-
>>> site_properties.exposeDCMetaTags = settings.exposeDCMetaTags
838-
>>> site_properties.webstats_js = settings.webstats_js
844+
>>> portal.site_description = settings.site_description
845+
>>> site_properties.enable_sitemap = settings.enable_sitemap
846+
>>> site_properties.exposeDCMetaTags = settings.exposeDCMetaTags
847+
>>> site_properties.webstats_js = settings.webstats_js
839848

840-
>>> settings.enable_sitemap -> plone.app.layout
849+
>>> settings.enable_sitemap -> plone.app.layout
841850
```
842851

843852
Plone 5.x
844853

845-
```python
854+
```pycon
846855
>>> from Products.CMFPlone.interfaces import ISiteSchema
847856
>>> site_settings = registry.forInterface(ISiteSchema, prefix='plone')
848857

@@ -863,7 +872,7 @@ u''
863872

864873
Plone 5.x
865874

866-
```python
875+
```pycon
867876
>>> from Products.CMFPlone.interfaces.controlpanel import IDateAndTimeSchema
868877
>>> tz_settings = registry.forInterface(IDateAndTimeSchema, prefix='plone')
869878

@@ -874,7 +883,7 @@ Plone 5.x
874883

875884
Plone 5.x
876885

877-
```python
886+
```pycon
878887
>>> from Products.CMFPlone.interfaces import IMarkupSchema
879888
>>> markup_settings = registry.forInterface(IMarkupSchema, prefix='plone')
880889

@@ -889,7 +898,7 @@ u'text/html'
889898

890899
Plone 5.x
891900

892-
```python
901+
```pycon
893902
>>> from Products.CMFPlone.interfaces import IUserGroupsSettingsSchema
894903
>>> usergroups_settings = registry.forInterface(IUserGroupsSettingsSchema, prefix='plone')
895904

@@ -945,8 +954,9 @@ browser_manager.getControl(name='form.widgets.IPublication.effective').value = '
945954

946955
### parentMetaTypesNotToQuery
947956

957+
Old 4.x approach:
958+
948959
```xml
949-
# OLD 4.x approach
950960
<object name="portal_properties">
951961
<object name="navtree_properties">
952962
<property name="parentMetaTypesNotToQuery" purge="false">
@@ -956,10 +966,9 @@ browser_manager.getControl(name='form.widgets.IPublication.effective').value = '
956966
</object>
957967
```
958968

959-
Now in `registry.xml` should look like
969+
Now in Plone 5, {file}`registry.xml` should look like the following:
960970

961971
```xml
962-
# NEW in 5.0
963972
<?xml version="1.0"?>
964973
<registry>
965974
<record
@@ -975,14 +984,16 @@ Now in `registry.xml` should look like
975984

976985
### metaTypesNotToList
977986

987+
Old 4.x approach:
988+
978989
```xml
979-
# OLD 4.x approach
980990
<?xml version="1.0"?>
981991
<object name="portal_properties">
982992
<object name="navtree_properties">
983993
<property name="metaTypesNotToList" purge="false">
984994
<element value="my.hidden.content.type" />
985995
</property>
996+
</object>
986997
</object>
987998
```
988999

@@ -996,8 +1007,9 @@ if you don't want your content type to show there's nothing to do.
9961007

9971008
### typesLinkToFolderContentsInFC
9981009

1010+
Old 4.x approach:
1011+
9991012
```xml
1000-
# OLD 4.x approach
10011013
<?xml version="1.0"?>
10021014
<object name="portal_properties">
10031015
<object name="site_properties">
@@ -1008,10 +1020,9 @@ if you don't want your content type to show there's nothing to do.
10081020
</object>
10091021
```
10101022

1011-
Now in `registry.xml` should look like
1023+
Now in Plone 5, {file}`registry.xml` should look like the following:
10121024

10131025
```xml
1014-
# NEW in Plone 5
10151026
<record
10161027
name="plone.types_use_view_action_in_listings"
10171028
interface="Products.CMFPlone.interfaces.controlpanel.ITypesSchema"
@@ -1024,8 +1035,9 @@ Now in `registry.xml` should look like
10241035

10251036
### types_not_searched
10261037

1038+
Old 4.x approach:
1039+
10271040
```xml
1028-
# OLD 4.x approach
10291041
<?xml version="1.0"?>
10301042
<object name="portal_properties">
10311043
<object name="site_properties">
@@ -1036,10 +1048,9 @@ Now in `registry.xml` should look like
10361048
</object>
10371049
```
10381050

1039-
Now in `registry.xml` should look like
1051+
Now in Plone 5, {file}`registry.xml` should look like the following:
10401052

10411053
```xml
1042-
# NEW in Plone 5
10431054
<?xml version="1.0"?>
10441055
<registry>
10451056
<record

0 commit comments

Comments
 (0)