Plone Upgrade Guide
Note: Return to reference manual view.
1. Introduction
Generally, you will often see the word "migration" used as the word we use to describe the process of getting your Plone site from one version of a given component to a newer version. For most people, this means upgrading Plone to a newer release, for example from 2.1.3 to 2.5.
Migration is necessary because the internals of Plone sometimes change to support new functionality. When that's the case, the content which is stored in your Plone instance may not match what the new version of the software expects. Plone has a builtin tool that migrates existing content to the new structure.
This guide describes migration in Plone, specifically how you upgrade between different versions.
Before migrating you should read this entire document to understand the potential impact migrating will have on your Plone site. In particular, read everything in the "common problems and issues" section.
The guide applies to all contemporary versions of Plone, and we have also included the older, unsupported versions for reference.
A note about version numbering and terminology
Up until Plone 2.1, the policy was that each of our major releases would be incremented 0.1, like a standard framework policy. This caused some confusion and false expectations on how complex an upgrade would be, and have since changed this policy.
Starting with the 2.5 release, the Plone Team aims to release a new version roughly every 6-9 months, so we have moved to a policy that increases the version number by 0.5 on every significant release. This means that when we say a "major release", we are referring to a x.0 or x.5 release, whereas a minor release has the version numbering 2.5.x or 3.0.x.
In addition to this general procedure there are excellent version-specific migration guides. These guides contain more specific instructions and valuable information that has been collected from real-life migration cases.
2. Preparations
Gather information
- Read the "What's new in..." for your relevant plone version, and read the release notes. You'll find these in the CMFPlone directory of the distribution of the new version of Plone.
- Check for dependencies
- Read the release notes for the Plone release you are upgrading to, in particular:
- What version of Python is required?
- What version of Zope is required?
- Do you need any new python libraries?
- Make sure all the add-on products you are using have updated to support the version of Plone you are upgrading to.
- Start with the third-party products that are in use on your site. Verify that they have been updated or verified to work on the new version, and get them upgraded in your existing instance before you start the Plone/Zope/Python upgrade if possible.
- If Zope depends on a newer version of Python, install the new version of Python first.
- If the newer version of Plone depends on a newer version of Zope, you will need to install that before proceeding with the Plone upgrade.
- NOTE: Zope has it's own migration guidelines, which you will find in the release notes of the version you are migrating to. If Plone is being upgraded at the same time as a Zope version, Plone will usually handle the Zope upgrade with its own migration script.
Read the following files in the CMFPlone directory of the distribution of the new version of Plone you want to update to:
- README.txt
- INSTALL.txt
- UPGRADE.txt (although this usually contains only the general procedure outlined above)
Back up your Plone site
It's very important to back up your Plone site. You will find an excellent how-to on backing up your Plone site here.
Setup a test environment to rehearse the upgrade
Never work directly on your live site until you know that the upgrade was successful. Instead, create a test environment to rehearse the upgrade. Copy your instance into a new environment and upgrade the copy. This is a good way of working out your third party products and dependencies in preparation for the final upgrade of the live site!
3. General procedure
When upgrading to a newer release of Plone, it is important to run the content migration procedure, since internal structures in Plone might have changed since the last version. This is the general procedure for upgrading.
Before you start upgrading anything, make sure you have a backup.
The basic manual procedure is detailed below. If you are using the installers, you can skip the part about moving away directories and replacing them with the new ones (step 3-4) - it should be handled by the installer for you.
- Back up your entire Plone directory
- Shut down your Plone server instance
- Remove the Product directories you want to replace (ie. the ones in the package you downloaded)
- Put in the new Product directories
- Start Plone again - your site may be inaccessible until we have performed the next steps - don't panic :)
- Go to http://yoursite/manage (aka. the ZMI) and click
portal_migrations - Make sure you are on the
Upgradetab (in older versions, this tab is calledMigrate) — it will state something like:Instance version: 2.5.3
File system version: 3.1.1 - This means that you have to run the upgrade procedure to be updated to 3.1.1.
- Click the
Upgradebutton.If you want to see what steps the upgrade would go through without making the actual changes, you can check the
Dry Runoption - this will do the exact same steps as a normal upgrade/migration will do, but not write anything to the database. - The site will now be updated, this may take a while, depending on which versions you upgrade from/to. For example, the upgrade from Plone 2.0 to Plone 2.1 involves conversion and re-cataloging of all content in your site, so if you have a big site, this may take a while. Be patient.
For those of you who wonder why we don't do this automatically, the reason is that we don't want to change your data without you knowing it, and you should have the opportunity to back up the data before doing this, etc.
For advanced/enterprise users: It is normally possible to upgrade in-place (at least between minor versions) without any site downtime if you run ZEO and multiple load-balanced instances. See the ZEO documentation for more information if you need this.
4. Upgrade add-on products
- Shut down your Plone server instance
- Navigate to your Plone instance product directory
- Remove the directories of the products you want/ need to replace
- Copy the new product directories across, and check that the permissions on each product directory are correct
- Start Plone again - your site may be inaccessible until we have performed the next step - don't panic :)
- Navigate to the quickinstaller in the ZMI, and reinstall or upgrade products if you can (products that support both your current
and new version of Plone). Perform product-specific upgrade procedures (if any). You will find these in the docs of each product
5. Troubleshooting
When a problem occurs during the migration we recommend that you take the following steps.
Check the log files
When a site error occurs, or Zope fails to start, there's probably an informative error message in Zope's log files. Locate these log files and inspect event.log. Ignore irrelevant warnings and search for words such as error, exception and traceback (case-insensitive).
When Zope doesn't start and there's no useful information in the log file, you can start Zope interactively and watch for error messages in the output:
zopectl fg
You may be able to find more information on the error messages in:
- the Version-specific migration tips for your version of Plone
- the Error References
- the pastebin - where error messages and code fragments are shared and debugged collectively
Test without customizations
When you have customized page templates or Python scripts, your changes may interfere with changes in the new version of Plone. It's important to rule out this possibility, since your customizations are unique to your site and no one on the planet will be able to help you solve it.
Temporarily remove your customizations, for example by removing your layers from portal_skins, or by removing files from these layers on the file system. If the problem disappears, you'll need to doublecheck your customizations. It's usually best to copy the original files of the new version of Plone to your skin, and re-customize those.
Test without products
Bugs or compatibility problems in products that you have installed may cause problems in Plone. Go to Site Setup > Add/Remove Products and remove (uninstall) all product that are not distributed with Plone. Remove the uninstalled products from the Products directory of your Zope instance.
If the problem disappears, you'll need to doublecheck the offending product:
- Does it support the new version of Plone, Zope and Python? Check the product's README.txt or other informational files or pages.
- Does the product require any additional migration procedures? Check the product's INSTALL.txt, UPGRADE.txt or other informational files or pages.
- Does the product install properly? Re-install it and check the install log.
Test with a fresh Plone instance
Create a new Plone site with your new version of Plone. You don't need a new Zope instance, since you can add another Plone site in the root of Zope. If the problem does not occur in a fresh site, the cause of your problem is most likely a customization, an installed product or content that was not migrated properly.
Make the problem reproducible
Before you go out and ask for help, you should be able to describe your problem in such a way that others can reproduce it in their environment.
Reduce the problem to the smallest possible domain. Eliminate products and customizations that are not part of the problem. This makes it easier for others to reproduce the problem and it increases your chances of meeting others with the same problem or even a solution. The more complex your story is, the more likely that it is unique to your situation and inpenetrable to others.
Ask for help on a mailing list
Ask for help on the Plone setup list. Be sure to:
- Provide relevant source code for your customizations that are part of the problem.
- Describe the exact configuration, software versions, migration history, error messages and so on.
Report a bug
Once you have investigated, analyzed, identified and confirmed the cause of your problem and you are convinced it's a bug (rather than an X-file), go to the appropriate bug tracker and report it:
- Products: the README usually tells how to report bugs
* Plone Issue Tracker
* CMF Issue Collector (if you don't know what the CMF is, don't report bugs)
* Zope Issue Collector
Do not use the bug trackers to ask for help. First analyze your problem and assert that it's a bug before you report it.
6. Version-specific migration procedures and tips
6.1. Upgrading from Plone 1.0 to 2.0
The changes made to Plone between 1.0 to 2.0 are fairly complex. Before migrating you can read this document to understand the potential impact migrating will have on your website. We suggest to follow standard practices: backup your Products and Data.fs file(s), do the actual migration on a test instance., etc. Another note is that Plone's migration are probably not perfect - this is hard to guarantee, since we can't predict just how you have changed your system.
If you have a big site running Plone and want a painless transition to the much-improved version 2.0, we suggest that you hire a company that can do the migration properly for you. Send a mail to the Plone Developer mailing list, and we can recommend a company in your area if needed.
The migration tool handles most cases, but your mileage may vary. Heavily customized sites should factor in some time to do the transition.
Side Effects Moving to 2.0
- Plone CSS has radically changed.
- Plone Templates have radically changed.
- Plone 2.0 Tools Tools for Plone have changed
- Plone 2.0 Group User Folder the User Folder for Plone has changed
- See the What's New in Plone 2.0 Guide for more information about what has changed.
Template/CSS Changes
The templates and CSS have been refactored and reorganized to be leaner, more efficient and more logically laid out. The CSS class names have been changed to be consistent and to provide easier customization. Therefore, if your site customized the templates or CSS, you will have to examine how your changes are affected by the new templates and CSS.
- ploneDeprecated.css
- About the tableless layout
- base_properties vs. stylesheet_properties
- Form changes: New Forms Style and How to Convert from the Plone 1.0 forms format
- CSS Nameageddon - the CSS class names have changed from Plone 1 to Plone 2
base_properties
Plone 1 shipped with a property sheet called stylesheet_properties, that enabled you to change your site in a quick and easy way.
In Plone 2, we have stripped this down a bit, and changed its name to base_properties to better reflect what it's for.
The reason for this was that the stylesheet_properties was kind of a half-way mix of color properties and CSS, and you could do much more than simple color changes with it. This complicated things for the CSS people, and thus we decided to keep the separation cleaner, and have only base properties in the variables.
It's not possible to do a perfect 1:1 mapping between the two, and you might have to resort to a few simple CSS rules to replicate what you had in Plone 1. The good news is that it's much more flexible and powerful this way.
The best approach to converting to the new scheme is to start with the existing base_properties, and move your color and border values over one by one until you have something that resembles your old layout.
Lexicons
lexicon in portal_catalog is set as plone_lexicon. Look at your ZCTextIndex indexes to see what lexicon they are looking for. On plone.org, we needed to rename the lexicon to zc_lexicon (or we could have recreated the ZCTextIndexes and specified whatever lexicon you have.) Even if your ZCTextIndex indexes are looking for the right index, you may benefit from re-indexing those fields.
Special Note about the Windows Installer
You have to uninstall previous Plone versions and delete the Plone service before you can install Plone 2 successfully on Windows XP. The service doesn't delete by itself when you uninstall.
6.2. Upgrading from Plone 2.0 to 2.1
A note about migration and version numbering
Plone has changed significantly infrastructure-wise with the jump from Plone 2.0 to 2.1. Plone 2.1 represents 18 months of active development and improvements, and is a much more scalable and powerful platform with the 2.1 release.
Some people are confused by the low version number increase, and mistakenly assume that it is a minor upgrade. It is not, far from it.
Up until Plone 2.1, the policy was that each of our major releases would be incremented 0.1, like a standard framework policy. We understand that this is somewhat confusing, and have since changed this policy. The Plone Team aims to release a new version roughly every 6 months, so we have moved to a policy that increases the version number by 0.5 on every significant release.
We have done this to better reflect the enormous amount of work that goes into each release, and to better illustrate what you can expect from a release.
The main point here is that even if an upgrade from 2.0 to 2.1 sounds minor, in this particular case it is not. The entire content type infrastructure has been rewritten, and all your content needs to be transferred to the new types, so there will most likely be some pain involved on some level — be it third-party products, templates that need to be re-customized, or actual bugs in the migration machinery (which have mostly been ironed out with the 2.1 and 2.1.1 releases).
About the migration
Please note that it is difficult to predict how well migration will work, since we can't know just how you have changed your system. Plone is a very flexible system, but when migrating this will affect the outcome based on what you changes you have made to your system.
- If you have a standard Plone site with simple customizations, it will likely work very well.
- If you have installed and depend on a lot of third-party products produced by developers outside the Plone Team, it's hard to say something definite - make sure the products you depend on are certified to work with Plone 2.1.x. Special note about SpeedPack: You should uninstall this product, as most of the improvements done in this product are now part of Plone, and as a result, it's no longer necessary (and it doesn't work on Zope 2.8).
- If you have a big site running Plone and want a painless transition to the much-improved version 2.1, we suggest that you hire a company that can do the migration properly for you. Send a mail to the Plone Developer mailing list, and we can recommend a company in your area if needed.
The migration tool handles most cases, but your mileage may vary. Heavily customized sites should factor in some time to do the transition.
For Plone 2.5 (our next upcoming release), there are substantial improvements to the architecture that will ease migration in the future, as well as providing good tools for exporting and importing content and configurations.
Plone 2.1.2 and later releases also includes significant improvements to the migration machinery based on feedback we got from people doing migrations, so if migrating your site using the Plone 2.1 or 2.1.1 release didn't work out for you, please give the new version a try.
Performing the migration
Before you start the migration, you should decide what approach you want to use. There are two common ways of migrating:
- Migrating your site content, products and customizations in-place.
- Exporting your content, creating a fresh Plone 2.1 site, importing your content.
The in-place migration is more comprehensive, and hence more error-prone, especially if you have misbehaving third-party products or very old Plone instances. If your content is the most important thing for you, and you don't mind applying your configuration settings and simple customizations again, exporting all your content folders followed by an import into a clean instance might be a better approach for you. This procedure is described in the importing Plone 2.0 content into 2.1 FAQ. Please note that this should only be done if you are experiencing problems and as a last resort (or simply want to start with a clean site but keep your content) — for most people, in-place migration is the way to go.
The in-place procedure is the usual one for Plone migrations, a quick overview of the steps:
- If you want to upgrade from Zope 2.7 to Zope 2.8 in this transition, we advice you to stay with Zope 2.7 until you have completed the Plone part of the migration, then upgrade to 2.8. Zope 2.8 includes major changes and improvements, and trying to upgrade both Zope and Plone in the same operation is not recommended. Both Zope 2.7 and Zope 2.8 are supported platforms for Plone 2.1.x, though. As a rule of thumb, always start at the top with upgrades, and work your way down — upgrade Products, then Plone, then Zope, then Python.
- Make sure the third-party products you use have been updated or verified to work on Plone 2.1. Upgrading to 2.1 if the products you are using do not support it is a frustrating experience.
- Install the new Plone version in a clean location, you should stick with the same major version of Zope (e.g. going from Zope 2.7.3 to 2.7.5 is OK, going from 2.7.x to 2.8.x is not recommended until the Plone part of the migration is done).
- Move over your
Data.fsand any Products / External Methods to the new instance. - Start the new Zope/Plone
- Log in to the ZMI as a
Manageruser. - Go to
portal_migration - Click the migrate button and wait for the output from the migration process. This can take a considerable amount of time depending on your site, since all content is being re-created with the new content types, and re-cataloged.
Common problems and issues
- Several "new" tabs will appear at the top of the site. This is due to a policy change in how Plone constructs navigation. Plone 2.1 and up will automatically make tabs from the folders in the root, and doesn't require you to manually create them in the portal_actions tool anymore. To fix this, you can either:
- Go in and delete your portal_actions entries to only use the root folders (the folders also have individual visibility settings in the Properties tab of each item). This is the recommended approach unless you have global tabs leading deep inside the site, or:
- Turn off the automatic tab generation in the
Site Setup→Navigation Settings. This will make the global tabs behave the way they did in 2.0.
- All the content items and folders that you have the permissions to view now show up in the nav tree - if you want the old behavior from Plone 2.0 back, where only folders show up — and only those who are published — you can now control the navigation setup in
Site Setup→Navigation Settings. - If you have an item with the short name
eventsornewsin the root of your site, they should be renamed before starting the migration - since this can cause problems with the migration to the new Smart Folders that list these. - If you get
AttributeError: referencebrowser_startupDirectory, you are unpacking the Plone tarball with WinZip, which mangles long file names and has a lot of other problems. Get a proper unpacking tool like WinRAR instead. - One of the problems that people run into during migration is third-party products they have installed that didn't clean up after themselves, or that left behind "dead" content when uninstalled. This can trip up the migration process. Here is a simple script that can list content with no associated product, so you can remove the defunct objects. To use it, create a
Script (Python)from the ZMI add menu in the root of your Plone site, paste in the code from this file, clickSaveand then click theTesttab to run the script. It should list dead object locations, so you can go and delete them manually if needed:portal_types = context.portal_types.objectIds() print "Dead Content Type Inspector" print for i in context.portal_catalog.uniqueValuesFor('portal_type'): if i in portal_types: continue print i results = context.portal_catalog(portal_type=i) for i in results: print i.getURL() print print return printed - Another error that was often encountered in Plone 2.1 and 2.1.1 was that some objects weren't converted to the new Archetypes-based types. If you get: "maximum recursion depth exceeded" on viewing your site after the migration, the folders/objects are most likely still CMF objects, not Archetypes objects. Plone 2.1.2 includes a fix that tries to work around this problem. (The reason this exists in the first place seems to be bad behaviour introduced in the Plone 2.0 Release Candidates and subsequently fixed before the 2.0 final release, but some people still have content created with the Release Candidates.) Also note that this error message can show up if you customized a 2.0
document_viewtemplate and are trying to use it with Plone 2.1. - If all (or some of) the migrated content are owned by the person doing the migration instead of the original author, that means that Plone was unable to look up the owner info while migrating. The cause of this is normally that your users are stored in LDAP and you haven't set up the connection before doing the migration. Another possibility is that your users are defined outside the Plone site.
- If you don't get any images in the image views or thumbnails in the summary listings: PIL is now a dependency, and you will not get image scaling if it is not installed. Also, you need to make sure zlib (for PNG support) and libjpeg is installed before you install PIL. More information can be found here.
- If your content column is missing on all pages, one of the portlets you have set up is broken. Some versions of Plone (including the RCs of 2.1.2) had a bug where it would just stop rendering the content column instead of giving you an error if one of your portlets break.
- Some people are also confused about the behavior of security in 2.0 vs. 2.1: A bug in Plone 2.0 made it so that it seemed to be the case that if any folder along the path to an item was private, that item could not be viewed, regardless of its state. Workflows in Plone behave in a different way, though - allowing you to have a folder that is private, and have a published item inside it that is accessible (but the folder will be inaccessible). If you want your permissions to inherit down the path, you'll have to make some changes to the workflow, documented here. The reason this seemed to work in Plone 2.0 was a bug in the breadcrumb handling code, and the object wasn't protected there either, but erroneously seemed to be.
- If you get the error
AttributeError: _length, you are upgrading to Zope 2.8, and you will need to callmanage_convertIndexeson all catalogs that are not in the root (CMFCollector catalogs etc). Third-party products sometimes have their own catalogs, check with the product maintainer about this. See the section "Upgrading from Earlier Versions of Zope" in the fileZope-2.8.4-final/doc/FAQ.txt. - If LiveSearch doesn't work or you have other symptoms that looks like the catalog isn't working properly, check out the FAQ on disappearing catalogs
- If you get
AttributeError: toPortalTimefrom a third-party product, it needs to update itself to usetoLocalizedTimeinstead.toPortalTimewas deprecated in Plone 2.0, and is removed in Plone 2.1. - If for some reason some of the original tools are corrupted or not working properly, you can copy in fresh instances from a newly-created Plone site. I will show an example where the
portal_form_controllertool is not present in the migrated site. Typically you would get AttributeError: portal_form_controller as an error message. In this example, {Zope} represents the Zope root (for example, localhost:8080)and {Plone} represents your Plone site:- Go to
http://{Zope}/manage_mainand log in with a Manager user. - Add Plone Site from the pulldown menu
- Call it
TempPlone - Once the Plone site is created, go to 'http://{Zope}/TempPlone/manage_main
- Check the box next to
portal_form_controller, and clickCutat the bottom of the page. - Go to http://{Zope}/{Plone}/manage_main
- Make sure there is no
portal_form_controllerin the list. If there is, delete it. - Click the
Pastebutton at the bottom of the form. - Your site now has a fresh
portal_form_controllerfrom a new Plone 2.1 site, and should work properly. You can now delete theTempPloneinstance.
- Go to
Additional notes
- If you still have problems, create an issue in the issue tracker - make sure you use the Upgrade / Migration topic, and remember to search before submitting an issue to minimize duplicates. Make sure you provide as much detail as possible on your configuration and setup, so we can better help you.
Tip: How to re-customize your templates
If you have done significant changes to the Plone 2.0 templates (functionally, that is - the CSS classes are mostly the same as in 2.0), you may have to re-apply these customizations to the 2.1 templates. The best way to do this is:
- Have one directory with the original Plone 2.0 templates
- Compare your customized templates with the original Plone 2.0 ones (a visual diff tool is useful for this - we recommend Meld for Linux, FileMerge (included in XCode) for Mac OS X, and WinMerge for Windows)
- Apply those changes to the 2.1 templates. Of course, your customizations should not touch the original Plone 2.1 files, so make sure you place your customized templates in a file system Product, or in the
customdirectory inportal_skins.
Postscript
This document was written as an attempt to collect all the relevant information about migrating from 2.0 to 2.1 in one location. It would be impossible without all the hard-working people in the Plone Team writing the migration code (which is a boring and complex task) in the first place, and the helpful people on the Plone Setup list, who have helped a lot of people migrate successfully. You all rock!
6.3. Upgrading from Plone 2.1 to 2.5
There are no version-specific procedures or tips for the migration of Plone 2.1 to 2.5 at this time. We expect the general procedure outlined in this manual to be sufficient.
6.4. Upgrading Plone 2.5 to 3.0
6.4.1. Upgrading a Plone 2.5 site to 3.0
- To migrate from Plone 2.5 to 3.0, please follow the steps outlined in the General approach to upgrading.
- One thing to make sure you have right is that Plone is now not only files in the
Products directory, but also modules insidelib/pythonin your instance. If you're using the installers, this is taken care of for you, but if you're doing it manually, make sure thelib/pythoncomponents are in the right location.
Third party products
If you have installed and depend on a lot of third-party products produced by developers outside the Plone Team, it's hard to say something definite - make sure the products you depend on are certified to work with Plone 3. GroupUserFolder is NOT supported! (NOTE: It may not be possible to upgrade a site using GRUF with external user folders such as LDAPUserFolder. In those cases it is advised to create a new site and move the content over manually.)
If you have a big site running Plone and want a painless transition to the much-improved version 3, we suggest that you hire a company that can do the migration properly for you. Send a mail to the Plone Developer mailing list, and we can recommend a company in your area if needed.
Notes on Zope migration
Migration from Zope 2.8.7 or 2.9.5 to Zope 2.10.x is mandatory but Plone 3 does not run natively on Zope 3. If you are upgrading from Zope 2.8.7 and you have a separate Five product you need to delete the Five product from your product directory before your upgrade.
Zope 2.10.x requires Python 2.4.3+ (Python 2.4.2 is still acceptable). Also mandatory is Python Imaging Library 1.1.5 or newer, Python ElementTree.
Caching
* Caching related changes required (or maybe none!)
6.4.2. Updating add-on products for Plone 3.0
6.4.2.1. General product development and migration tips for Plone 3.0
Depending on your product, it might be hard to include compatibility for both Plone 2.5 and Plone 3.0 in the same product. There are several reasons for this, but the main ones are:
- The workflow definition standard in CMF has changed
- The new portlet infrastructure (although it does support old-style portlets, performance will suffer)
- The introduction of viewlets as the main way to render content fragments in the layout
So, the general recommendation is:
- If your product is more complex than a simple type, create two releases — one for Plone 2.5 and one for Plone 3.0.
- If you used ArchGenXML to create your product, you should be able to regenerate your product from the UML model to get a Plone 3.0-compatible version.
Tip
- To further future-proof your product (for Plone 3.5 and 4.0), try the following:
- Start Zope in debug mode using
zopectl fgand use your product normally. Check if it outputs any deprecation warnings to the log window. - Disable the
plone_deprecatedskin layer and make sure your application still runs without it (this disables deprecated methods and deprecated CSS styles)
- Start Zope in debug mode using
Other recommendations and suggestions
- You can use the contentmigration product to write migrations for your own products. More information on this product can be found in the RichDocument tutorial
- A lot of the new components use Zope 3 views instead of templates. These can be customized through-the-web using the
portal_view_customizationstool. - Do not ever rely on the JS libraries in Plone being the same across releases. Use the KSS abstractions, the underlying implementation might (and will!) change.
These things are not mandatory yet, but represent best-practice recommendations that will save you from updating these parts in the future:
- QuickInstaller-based installation should use GenericSetup profiles instead
- use events instead of manage_ methods (which will probably disappear in plone 3.5 or 4.0)
- Packaging technology:
- Use python packages instead of Zope products
- Ship packages as eggs and register them with the Python Cheese Shop
- Use Python Paste to create new packages
6.4.2.2. CMFCore.permissions import syntax change
Typical error message when starting Zope:
File "Products/PloneHelpCenter/content/HelpCenter.py", line 29, in ?
from Products.CMFCore import CMFCorePermissions
ImportError: cannot import name CMFCorePermissions
What's causing it:
The following line is a common statement to get access to the permissions module, typically in the __init__.py file:
from Products.CMFCore import CMFCorePermissions
To make this work with both the new way of importing it and fall back to the old way if you're running an older version, replace the above with:
try: # New CMF
from Products.CMFCore import permissions as CMFCorePermissions
except ImportError: # Old CMF
from Products.CMFCore import CMFCorePermissions
Then you should be all set, and be able to support multiple versions with your product. Note that the try/except block is only necessary if you want to support Plone 2.1, if you're targeting Plone 2.5 and above, you only have to do the variant listed under "New CMF" in the example above.
To see a live example of this change, consult Poi changeset 40594.
6.4.2.3. Transaction module is no longer implicitly in Archetypes
Typical error message when starting Zope:
from Products.Archetypes import transaction ImportError: cannot import name transaction
Archetypes no longer imports transaction, so you will have to do it in your own module now, if you are using it. Change occurences of:
from Products.Archetypes import transaction
to:
import transaction
For a live example, see Poi changeset 40594.
6.4.2.4. get_transaction module rename
Typical error message:
NameError: global name 'get_transaction' is not defined
Just to show you a complete traceback of how this might look, here's the full thing as seen in a typical product install, where it is common to use subtransactions (for completeness and search engines):
2007-04-12 23:12:01 ERROR Zope.SiteErrorLog http://localhost:8080/nu/portal_quickinstaller/installProducts
Traceback (innermost last):
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 381, in installProduct
- __traceback_info__: ('Poi',)
Module Products.ExternalMethod.ExternalMethod, line 231, in __call__
- __traceback_info__: ((<PloneSite at /nu>,), {'reinstall': False}, (False,))
Module /Users/limi/Projects/Plone/3.0/Products/Poi/Extensions/Install.py, line 65, in install
NameError: global name 'get_transaction' is not defined
/Users/limi/Projects/Plone/3.0/Products/CMFQuickInstallerTool/QuickInstallerTool.py:409:
DeprecationWarning: This will be removed in ZODB 3.7:
subtransactions are deprecated; use sp.rollback() instead of transaction.abort(1),
where `sp` is the corresponding savepoint captured earlier
transaction.abort(sub=True)
To update this, replace:
get_transaction().commit(1)
with:
transaction.commit(1)
(keep the (1) part if it already exists in the code, omit it otherwise)
You might have to add an import transaction statement at the top of your file if you haven't imported it already.
For a live example, see the Install.py part of Poi changeset 40594.
6.4.2.5. ContentFactoryMetadata deprecation
Typical error message:
Error Type: exceptions.ImportError Error Value: cannot import name ContentFactoryMetadata
What causes this? Somewhere in your code, you have something like:
from Products.CMFCore.TypesTool import ContentFactoryMetadata
Update this to:
from Products.CMFCore.TypesTool import FactoryTypeInformation
instead, and you should be good to go. This change should work all the way back to Plone 2.1.
For a live example, see DataGridField changeset 7901.
6.4.2.6. Update your workflows to use GenericSetup profiles
Installing workflows via GenericSetup will make your product work only on Plone 2.5 and upwards, so make sure you create a special release/branch if you want your product to still work on Plone 2.1/2.0 (which are unsupported releases when Plone 3.0 is released).
Typical error message that indicates that you are trying to install workflows not using GenericSetup:
ImportError: cannot import name addWorkflowFactory
For existing workflows, the easiest way to make the product install use GenericSetup for workflows is:
- Install your product (and its workflows) using Plone 2.5.
- Using the
portal_setuptool in the ZMI, export a snapshot of the current site profile:- Click the
Exporttab. - Select the parts you want to export the configuration for (in this case,
Workflow Tool). - Click the
Export Selected Stepsbutton. - You will now get a tar file named something like
setup_tool-20070424225827.tar.
- Click the
- Unpack the tar file, and put the resulting files and directories in a directory
profiles/default/in the root of your product. - Remove the workflow directories in
workflow/that are not part of your product, and editworkflows.xmlso that it only has the information for your workflows. See Poi changeset 41071 for an example. - Delete your old '.py'-based workflow definitions in
Extensions, but make sure you keep any workflow scripts, since these will be referenced from the profile definitions. - Add a
configure.zcmlfile in the root of your product that registers the default profile. See Poi's configure.zcml for an example. - Remove the redundant code from
Extensions/Install.pyand add the boilerplate code to invoke the GS setup, see Poi changeset 41071 for an example.
This process is also the same for any code you want to move to GenericSetup, in the Poi example, we also moved the catalog metadata and various other things to use GenericSetup profiles, and could get rid of most of Install.py in the process.
6.4.2.7. Searching users/groups via the Membership tool is deprecated
XXX Need examples of this. (Wichert)
6.4.2.8. Portlets have a new infrastructure
Portlets have been re-implemented using the Zope 3 component architecture. Change custom portlets to use plone.app.portlets if possible.
Old portlets are supported via a fallback mechanism called Classic Portlet; the portlet management screen has functionality for doing inline migration for old portlets. Note that using the old portlets mechanism will affect your site performance negatively.
XXX needs examples. (Martin?)
6.4.2.9. main_template now uses Zope 3 viewlets
If have previously shipped customized versions of templates like header.pt, viewThreadsAtBottom.pt or global_contentmenu.pt to get things into the page, please switch to viewlets instead, as it makes it much easier for multiple products to co-exist without stepping on each others changes.
Documentation and examples can be found in this tutorial.
6.4.2.10. Plone 3 does not create member folders by default
While this was always considered bad practice, it's now official. Don't do it. :)
6.4.2.11. Plone Tableless theme no longer exists
For those of you who desire a tableless implementation of the default skin, please backport the markup changes to the new main_template.
NuPlone (the new theme in Plone 3.0) is a table-less alternative that we hope you like.
6.4.2.12. Document Actions now use Zope 3 viewlets
The new approach uses viewlets, and its default position has also been moved to the bottom of the page. It also defaults to a text-based representation instead of the icons that it was using earlier, since document actions are often too abstract to create good icons for.
6.4.2.13. Products installing workflows may need to add permissions
The new "Editor" (aka. "Can Edit" on the Sharing page) in Plone 3.0 makes it easy to let people collaborate on content authoring. In some cases, editing also means the ability to add new objects inside the object people are editing.
For this to work, third party content types that add custom workflows will have to either use one of the standard "add content" permissions or explicitly give Editor the Add portal content role.
See Ticket #6265 for the changeset and full explanation.
6.4.2.14. Indexes declared in Archetypes schemata need to be moved to GenericSetup
This applies if you have moved from using install_types() in Extensions/Install.py, to installing new content types/FTIs with GenericSetup using a types.xml import step.
For each field that specifies an index, like this example from PoiIssue.py r40594
:
StringField(
name='issueType',
index="FieldIndex:schema",
widget=SelectionWidget(
label="Issue type",
description="Select the type of issue.",
label_msgid='Poi_label_issueType',
description_msgid='Poi_help_issueType',
i18n_domain='Poi',
),
enforceVocabulary=True,
vocabulary='getIssueTypesVocab',
required=True
),
…you need to move the creation to catalog.xml with GenericSetup. If there is index="FieldIndex", that means you need a new index, of type FieldIndex, with the name being the name of the accessor method:
<index name="getIssueType" meta_type="FieldIndex">
<indexed_attr value="getIssueType"/>
</index>
If there is also :schema or :metadata, e.g. index="FieldIndex:schema", you also need a metadata column:
<column value="getIssueType"/>
This is necessary because the schema does not really exist at install time, so there is no way GenericSetup can inspect it and configure new indexes. This was a bad design from the start, as portal-wide indexes do not belong in type-specific schemata anyway.
6.4.2.15. The "Sharing" tab is now a global action
The "Sharing" tab now points to the @@sharing view, and is defined as a global action in the object category. If you have a custom content type and you have set up the local_roles action, which would normally be pointing to the folder_localrole_from template, you should remove it. It will be removed from existing, installed types during migration.
If you do not remove the action, the user will see two "Sharing" tabs.
For an example of the canonical set of actions and aliases, see the GenericSetup definition of the Document FTI. Of course, you may not need the References, History or External Edit actions in your own types.
6.4.2.16. Multi page schemas
In Plone 3.0, all fields from all schematas will be loaded at once. If you depend on your schematas (fieldsets) to be processed one page after the other, you'll need to mark your Archetypes content type that uses it (not the schema itself) with the IMultiPageSchema interface.
The interface lives in Products.Archetypes.interfaces.IMultiPageSchema. The code to mark your content type would look like this:
from zope import interface from Products.Archetypes.interfaces import IMultiPageSchema # ... interface.alsoProvides(MyContentType, IMultiPageSchema)
6.4.2.17. Enable inline editing (aka. QuickEdit)
Adding inline editing and validation support to your view templates is as easy as calling the Archetypes widgets in view mode.
As an example, consider the following typical code from Plone 2.5:
<h1 tal:content="here/getSomeVariable" class="documentFirstHeading">
Variable goes here
</h1>
Now, to render the same thing, with an h1 tag and a class on it, you do:
<h1 class="documentFirstHeading">
<metal:field use-macro="python:here.widget('someVariable', mode='view')">
Variable goes here
</metal:field>
</h1>
This will keep whatever tags and styling you want around the item, and render the inline editing inside of it. It's also backwards compatible with earlier Plone versions — although these don't get the inline editing, obviously.
6.4.3. Updating 2.5.3 to 3.0.3
6.4.3.1. Migration Procedure
- Download and un-archive the Plone 3 universal installer package for Linux.
- Modify the install.sh script to point the PLONE_HOME variable to /var/plone/
- In the existing Plone site, take note of any non-Plone products that need to be moved to the upgraded instance.
It is advisable to un-install any non-essential third-party products before migrating to a new version. In most cases, products are the biggest obstacle to migrating a site, and weeding out unnecessary products can save a great deal of time and frustration. These products can be re-installed as new packages after migration.
It also seems necessary in some cases to remove installed caching objects (CacheFu), uninstall the caching products, and install new versions of the products and create new caching tools after migrating.
- As the root user (or with "sudo"), shut down the existing Plone/Zope/Zeo cluster:
/var/plone/zeocluster/bin/shutdowncluster.sh
- Move /var/plone/ to a backup folder, such as /var/plone253/
- Run the Plone 3 install.sh script with the "zeo" cluster option:
./install.sh zeo
- Start the new cluster:
/var/plone/zeocluster/bin/startcluster.sh
This can take some time, as a new Plone site is now created as part of the process. - Log into the ZMI as the "admin" user, using the password specified in /var/plone/zeocluster/adminPassword.txt:
http://localhost:8080/manage/
Once logged in, you may want to change the admin password to something more memorable (yet still secure) for future use:
http://localhost:8080/acl_users/users/manage_users?user_id=admin&passwd=1 - Stop the new cluster:
/var/plone/zeocluster/bin/shutdowncluster.sh
- In /var/plone/zeocluster/server/var/, create a backup/ folder, and move all existing contents to this new folder:
cd /var/plone/zeocluster/server/var/ mkdir backup mv Data.fs* backup/
Note that this step isn't completely necessary: you could just delete the existing files, but it's nice to back-up a working configuration in case things go wrong later.
- Copy Data.fs from the old instance to the new installation, and ensure the permissions are correct:
cp /var/plone253/zeocluster/server/var/Data.fs . chown plone:plone Data.fs
- Start the new cluster:
/var/plone/zeocluster/bin/startcluster.sh
- Log into the ZMI as the "admin" user:
http://localhost:8080/manage/ -
Note: this step is here presently only for the purpose of a full procedure review: it may be bug-related and should not be performed as part of a base migration. Try this only if all else fails.
In the ZMI, at the Plone site root, delete the following objects:
- content_type_registry
- mimetypes_registry
- portal_transforms
-
Note: this step is here presently only for the purpose of a full procedure review: it may be bug-related and should not be performed as part of a base migration. Try this only if all else fails.
At the site root, using the Add pull-down, add new versions of the Content Types Registry, MimetypesRegistry Tool, and PortalTransforms Tool (in that order). - At the site root, click portal_migration, and in the Upgrade tab, click the Upgrade button.
- After upgrading the site, click the View tab to test the main page.
- Click Site Setup, and then click Add/Remove Products.
- Under Installed Products, click the Migrate button to re-install any necessary existing products (in my case, this was CMFPlacefulWorkflow and Marshall).
- Download and un-archive any required products to /var/plone/zeocluster/Products
Make sure the product directories are complete, and that all contents have the proper owner ("plone"). - Re-start the cluster.
- In Site Setup on the Plone site, in Add/Remove Products, install the new products.