[Product-Developers] Re: A question regarding the definition.xml for a workflow

Françoise Conil fcodvpt at gmail.com
Wed Oct 7 12:16:52 UTC 2009


Thanks a lot for your explanations, I made a few tests and I would
appreciate another advice

2009/10/6 Martin Aspeli <optilude+lists at gmail.com>:
> Françoise Conil wrote:
>>
>> The following information make me doubt about the possibility to
>> modify an existing workflow (but I did not read all the documentation
>> again) :
>>
>>    http://plone.org/documentation/tutorial/genericsetup/the-setup-tool
>>
>>    Listen: the import steps that a profile registers are additive.
>> That means that whenever you select a new profile as the active
>> configuration, any new import steps are ADDed to the set of already
>> registered import steps.
>
> That's got nothing to do with this. It's still the same "workflow tool"
> import step, it's just operating on a different context (your own
> workflows.xml in this case).

Right, I made a test and I succeed in modifying an existing workflow
just by adding :
       workflows/intranet_workflow/definition.xml
to my profiles/default directory

I kept the entire definition.xml and modified it a little

Then I just had to run the workflow import step for my product

>
> It's the same for all steps. You can modify (with an extension profile) an
> FTI in portal types via types.xml + types/typename.xml. If you specify a
> subset of properties, those are updated, but others are kept the same. Same
> with propertiestool.xml: you don't wipe the portal_properties tool by using
> your own propertiestool.xml, unless you're running a base profile (which
> most people aren't).
>
>> Creating a new workflow is probably the best thing to do.
>
> Yes, but not for the reasons you mention. :)

So I created my own intranet_workflow and I would like to use this
workflow with CMFPlacefulWorkflow.

Hopefully, CMFPlacefulWorkflow can be easily configured as workflows,
but it is not installed by default.

I imagine my product has to install it so that the custom
CMFPlacefulWorkflow import steps get launched when my product is
installed.

I'm not sure to know the right way to do that. Looking at
optilux.policy, I imagine creating an Extensions/Install.py with the
following code :

import transaction
from Products.CMFCore.utils import getToolByName

PRODUCT_DEPENDENCIES = ('CMFPlacefulWorkflow',)

EXTENSION_PROFILES = ('myown.product:default',)

def install(self, reinstall=False):
    portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
    portal_setup = getToolByName(self, 'portal_setup')

    for product in PRODUCT_DEPENDENCIES:
        if reinstall and portal_quickinstaller.isProductInstalled(product):
            portal_quickinstaller.reinstallProducts([product])
            transaction.savepoint()
        elif not portal_quickinstaller.isProductInstalled(product):
            portal_quickinstaller.installProduct(product)
            transaction.savepoint()

    for extension_id in EXTENSION_PROFILES:
        portal_setup.runAllImportStepsFromProfile('profile-%s' %
extension_id, purge_old=False)
        product_name = extension_id.split(':')[0]
        portal_quickinstaller.notifyInstalled(product_name)
        transaction.savepoint()

is this correct ?

I'm not sure if I should create a profile/default/import-steps.xml
file with a dependency on CMFPlacefulWorkflow (I am not sure of the
name of the step) ?

<?xml version="1.0"?>
<import-steps>
 <import-step id="myproduct-various" ... >
     <dependency step="portal_placeful_workflow" />
 </import-step>
</import-steps>

is it good ?

> Martin
>
> --
> Author of `Professional Plone Development`, a book for developers who
> want to work with Plone. See http://martinaspeli.net/plone-book
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>




More information about the Product-Developers mailing list