Gilles Lenfant wrote:
Le 26 juin 08 à 17:23, Derek Richardson a écrit :
My question. I have v1 of a product that contains GS for utilities A
and B. In v2, I am adding a utility C. If someone upgrades, I want
them to get C without re-installing A or B, to prevent data loss.
However, if someone installs v2 fresh, I want them to get A, B, *and*
C. Will registering an upgrade step for v1 to v2 that installs C
accomplish this? I imagine it does, as the upgrade step would be of
limited utility without this functionality, but haven't seen this
explicitly stated anywhere.
Yes it does. The handler of an upgrade step is just a function that has
the portal_setup object(*) as argument. This function only needs to add
C, either programmatically or by running a GS import step like this :
def myUpgradeHandler(setuptool):
"""Add only C to existing config"""
setuptool.runAllImportStepsFromProfile('profile-my.component:upgrade_v1_v2',
...)
Of course you need to register with some ZCML that extension profile
(upgrade_v1_v2 for my.component) that only contains features of C. when
the defaut profile contains A, B and C.
(*) I would have preferred a "context" as in usual setup handlers, such
functions from setup handlers could be used easily from upgrade steps.
Aha! So, I need to add the registration of C to the default profile to
get it installed when someone does a fresh install *and* add an upgrade
step that installs it when someone does an upgrade? I was hoping that
the upgrade step would be automatically run after the default profile
import, so that I would only have to do it in one place. Oh well...
Derek
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers