[Product-Developers] Re: Questions regarding GS upgradeStep
Maurits van Rees
m.van.rees at zestsoftware.nl
Sat Sep 5 10:48:16 UTC 2009
Francois Barriere, on 2009-09-04:
> In my product I have added new lines to the diff_tool.xml file
> (under profiles/default), plus some fixes. I then registered an
> upgradeStep with the following configure.zcml snippet:
> title="Upgrade ATMEL.policy product"
> description="ATMEL.policy product migration/upgrade steps"
> The source is "*" as there was no previous upgrade step, I have a handler that
> does various fixes using Python code and defined the profile.
> When upgrading the Python code is executed by the regular import steps are
> not (the changes in profles/default/diff_tool.xml) are not reflected.
> I thought the upgrade would re-run the import steps of the profile...
No. One of the goals up upgrade steps is to have a means to *avoid*
having to apply the complete profile, as that can have unwanted side
effects. Probably the best known example is the catalog.xml: if you
specify an index there, then this index will be empty after applying
the profile (or just this import step), even when it already existed.
> Am I wrong? Should I force the import step from my Python code?
> In this case, what is the use of the "profile" attibute of the
The profile attribute marks this upgrade step as being an upgrade for
the ATMEL.policy:default profile and not for say the Products.Poi
If you want to reapply the complete profile in an upgrade step, you
can do that like this:
# In an upgrade step context is portal_setup
In you case PROFILE_ID is probably profile-ATMEL.policy:default.
To apply just one import step, do something like this; this is taken
# Run the update security on the workflow tool.
logger.info('Updating security settings. This may take a while...')
wf_tool = getToolByName(context, 'portal_workflow')
logger.info('Done updating security settings.')
BTW, this post of mine to the CMF mailing list with some notes about
which source and destination numbers to use may be of interest:
Specifying source="*" like you do will always make this step available
on the Upgrades tab of portal_setup, even right after you have run
it. At least that is the case with Plone 3.0-3.3.
Plus, not shown in that post, it is conceptually better to just use
integers as the source and destination number. metadata.xml and
version.txt need not have anything in common. I would say:
- set metadata.xml on 3
- use source="2"
- use destination="3"
It may be good to play around with these numbers and see what happens
in the UI.
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]
More information about the Product-Developers