[Zope-CMF] [GenericSetup] Extension profile re-installing base profile

Maurits van Rees m.van.rees at zestsoftware.nl
Tue Jun 23 03:04:50 EDT 2009


Andreas Jung, on 2009-06-23:
>
> We are currently migration from Zope 2.8/CMF 1.X to Zope 2.11/CMF 2.1.
>
> I have a minimal base profile and two almost identical extension
> profiles for
> product A and B (both containing toolset.xml, skins.xml and
> import_steps.xml).
> The setup code is almost identical with the one from
> CMFDefault.factory.addConfiguredSiteForm().
> So what's happening:
>
>  - creating a CMF site with the base profile + extension profile for A
> works as expected
>  - creating a CMF site with the base profile + extension profile for B
> works but the setuphandler
>    code of the base profile is executed twice (triggered through the
> installation of the extension
>    profile for B)
>
>  - creating a CMF site with the base profile + both extension profiles
> for A + B fails
>    with a 'Exisiting registration...' error
>
> General question: what might be the reason for extension profile B to
> trigger the reinstallation
> of the base profile (and its setuphandler)?

You say here that the base profile including its setuphandler is
applied twice.  Above you said that only the setuphandler is run
twice.  Which is it?

The setuphandler of the base profile should have some code like this
to make sure it is executed only at the moment the base profile itself
is applied:

  def setuphandler_from_base_profile(context):
      # Only run step if a flag file is present
      if context.readDataFile(flagfile_for_base_profile.txt') is None:
          return
      ... Do something useful here...

See for example
http://maurits.vanrees.org/weblog/archive/2007/06/discovering-genericsetup

But if a check like that is missing, I would expect this setuphandler
to be executed when applying profile A as well, which is not
happening.  Perhaps there is a check that somehow treats profile A and
B differently?

I would say go in with a pdb and see if the traceback tells you
anything about why the setuphandler gets executed again.

-- 
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 Zope-CMF mailing list