Skip to content.

Etria Lists

 

[quills-dev] [Fwd: Re: Automatically installing a GS profile from another product/library]

Tim Hicks tim at sitefusion.co.uk
Thu Sep 20 13:49:56 UTC 2007


Hi Tom,

I'm just wondering if someone has already made a fix to Quills along the
lines set out by Maurits below.  If not, we probably need this change so
that Quills will install properly...

Tim

-------- Original Message --------
Subject: Re: Automatically installing a GS profile from another
product/library
Date: Sun, 2 Sep 2007 19:23:43 +0000 (UTC)
From: Maurits van Rees <m.van.rees at zestsoftware.nl>
To: product-developers at lists.plone.org
References: <46DAF66A.7080900 at sitefusion.co.uk>

Hello Tim,

Tim Hicks, on 2007-09-02:
> I have a product ('Products.Quills') that has a GenericSetup profile.  I
> also have a library ('quills.app') that has a GS profile.  When
> Products.Quills is installed by the QI tool (in plone3), its profile
> gets applied automatically.  I want the quills.app profile to be applied
> automatically as well.
>
> To this end, I added an explicit call to:
>
>   setup_tool.runAllImportStepsFromProfile('profile-quills.app:default')
>
> in my importVarious setup handler.  However, when I do this, I seem to
> enter an infinite recursion.  From what I can tell, when portal_setup
> tries to apply the 'quills.app:default' profile, it ends up running
> Products.Quills's importVarious again, which obviously leads to the
> runAllImportStepsFromProfile call again...

The thing to realize here is that *all* steps that have been
registered with GenericSetup are run.  Somewhere there is a method
that is responsible for loading the info from the skins.xml file in
your profile.  This method is run even when you do not have such a
file.  The method checks if that file is there.  If it is found, the
method does its thing.  If the file is not found, the method returns
immediately.

> What's the right way of doing this?

You need to tell both setuphandlers to *only* run when their own
profile is being applied.  For quills.app (if that has an
import_steps.xml) you would do that by adding an empty file (or with
just some plain text to clarify) named e.g. quills_app_various.txt in
your profile directory.  Then in your setup handler check that this
file exists in the current import context and bail out if it is
missing:

def importVarious(context):
    # Only run step if a flag file is present
    if context.readDataFile('quills_app_various.txt') is None:
        return
    # Do your stuff here.


Same for Products.Quills, but choose a different file name there.

Read about it here:
http://maurits.vanrees.org/weblog/archive/2007/06/discovering-genericsetup

For examples, look at the eXtremeManagement code or look at
CMFPlone/profiles/default/plone_various.txt and grep in the CMFPlone
code for the 'plone_various.txt' string.


More information about the quills-dev mailing list