[Zope-CMF] Re: GenericSetup: How to use upgradeStep?

Maurits van Rees m.van.rees at zestsoftware.nl
Sat Sep 1 18:18:37 EDT 2007


I sent this message earlier this week via gmane but it seemed to have
problems at the time and I did not see the message show up.  So I try
again.  If anyone wants to react you can take your time as I will be
on vacation the next two weeks. :)

Maurits van Rees, on 2007-08-21:
> I am having problems understanding how the new upgradeStep
> functionality of GenericSetup works.  Maybe the most important
> question: is there a product that already uses this, so I can look at
> its code as an example?

I did not get any responses yet about this.  I went ahead and added an
upgradeStep to eXtremeManagement, a project management Product for
Plone.  The trunk there is meant for Plone 2.5 and 3.0 but some tabs
are duplicated in 3.0 so I wanted to fix that.  The upgrade step does
this.  The changeset is here:

http://dev.plone.org/collective/changeset/48097

The central piece of code there is the handler that simply runs all
steps from an extension profile that I added for this upgrade step:

  def from_plone25_to_30(context): 
      # Right, context == portal_setup here. 
      context.runAllImportStepsFromProfile( 
          'profile-Products.eXtremeManagement:eXtremeManagement-30-types', 
          purge_old=False) 

Does this way of using upgrade steps look sane?

Like I said in my previous post, there are two things that I do not
quite like about this or that I at least did not expect:

- I need to specify a handler even though I only want to run the
  import steps of a profile, which I now have to do by hand in that
  handler.

- I need to register an upgrade step *and* an extension profile, which
  feels double to me and which adds another profile to the list of
  extension profiles, which gets longer and longer.

I hope I do not sound too much as only complaining.  These upgrade
steps form a good foundation.  I just feel some parts are missing or
have room for improvement.  If other people feel the same way I do not
mind putting some code where my mouth is. :)

Or if I misunderstood how best to use upgrade steps, feel free to
enlighten me.

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Zope-CMF mailing list