[Product-Developers] Re: GS upgrade step docs and tests

Gilles Lenfant gilles.lenfant at ingeniweb.com
Thu Jun 26 16:50:40 UTC 2008


Le 26 juin 08 à 17:23, Derek Richardson a écrit :

> Martin Aspeli wrote:
>> Derek Richardson wrote:
>>> Looking at the distributed source for GS 1.3.3, I see upgrade.py,  
>>> but can't find the tests or docs. Will someone point me at them?  
>>> Or, else, point me at a good web resource? /me remembers seeing a  
>>> couple good blog posts, but can't find them now...
>> The last chapter in my book mentions them briefly. I had to figure  
>> it out from reading the tests in GenericSetup itself though. :-/
>
> Thanks! That brief mention is very helpful.
>
> 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.

>
>
> /me tried reading the GS tests, but your explanations (in book and  
> online) are much more digestible. ;)
>
> Derek
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers

-- 
Gilles Lenfant
INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632
Bureaux de la Colline
1 rue Royal
92210 Saint Cloud
web : www.ingeniweb.com - « les Services Web Ingénieux »









More information about the Product-Developers mailing list