A question regarding the definition.xml for a workflow

9 messages Options
Embed this post
Permalink
Mark Phillips () A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
I want to use the standard intranet workflow for my custom plone 3 site.
However, I need to change two of the permissions for one of the states.
What is the best practice for accomplishing this:

1. Copy the entire definition.xml for the intranet workflow and make the
changes

or

2. Can I just incorporate the changes in a definition.xml file and the
Workflow Tool will only change the two permissions?

Thanks!

Mark


_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
francoise () Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
I have the same question :

   Is it possible to modify an existing workflow with the workflow import handler ?

If it is possible, how should I do ?

Regards

Mark Phillips wrote:
I want to use the standard intranet workflow for my custom plone 3 site.
However, I need to change two of the permissions for one of the states.
What is the best practice for accomplishing this:

1. Copy the entire definition.xml for the intranet workflow and make the
changes

or

2. Can I just incorporate the changes in a definition.xml file and the
Workflow Tool will only change the two permissions?

Thanks!

Mark


_______________________________________________
Product-Developers mailing list
Product-Developers@lists.plone.org
http://lists.plone.org/mailman/listinfo/product-developers
Martin Aspeli () Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
francoise wrote:
> I have the same question :
>
>    Is it possible to modify an existing workflow with the workflow import
> handler ?
>
> If it is possible, how should I do ?

I don't see why not.

In your workflows.xml, you need to reference the name, and in
workflows/<name>/definition.xml you should include the workflow definition.

I'm not sure how much of the definition.xml you'll need to repeat. The
safest thing is possibly to copy the whole thing.

That said, it's probably better to just copy the workflow and make your
own workflow with the same name. This make it obvious that it's changed
from the default.

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
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
francoise () Re: Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
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.

Creating a new workflow is probably the best thing to do.

Thanks

2009/10/6 Martin Aspeli <[hidden email]>:

> francoise wrote:
>>
>> I have the same question :
>>   Is it possible to modify an existing workflow with the workflow import
>> handler ?
>>
>> If it is possible, how should I do ?
>
> I don't see why not.
>
> In your workflows.xml, you need to reference the name, and in
> workflows/<name>/definition.xml you should include the workflow definition.
>
> I'm not sure how much of the definition.xml you'll need to repeat. The
> safest thing is possibly to copy the whole thing.
>
> That said, it's probably better to just copy the workflow and make your own
> workflow with the same name. This make it obvious that it's changed from the
> default.
>
> 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
> [hidden email]
> http://lists.plone.org/mailman/listinfo/product-developers
>

_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
Martin Aspeli () Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
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).

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. :)

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
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
francoise () Re: Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
Thanks a lot for your explanations, I made a few tests and I would
appreciate another advice

2009/10/6 Martin Aspeli <[hidden email]>:

> 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
> [hidden email]
> http://lists.plone.org/mailman/listinfo/product-developers
>

_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
francoise () Re: Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
I did not succeed to install CMFPlacefulWorkflow as a dependency of my product.

either by creating a Extensions/Install.py, because
CMFPlacefulWorkflow is an egg of the Products namespace I presume
nor by adding a <include package="Products.CMFPlacefulWorkflow" /> to
the configure.zcml of my package

If someone know the right way ... I would be interested as I have no
more idea for this afternoon

Otherwise, the import steps created for CMFPlacefulWorkflow with my
new workflow works fine

Regards

_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
Maurits van Rees-3 () Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
Françoise Conil, on 2009-10-07:

> I did not succeed to install CMFPlacefulWorkflow as a dependency of my product.
>
> either by creating a Extensions/Install.py, because
> CMFPlacefulWorkflow is an egg of the Products namespace I presume
> nor by adding a <include package="Products.CMFPlacefulWorkflow" /> to
> the configure.zcml of my package
>
> If someone know the right way ... I would be interested as I have no
> more idea for this afternoon
>
> Otherwise, the import steps created for CMFPlacefulWorkflow with my
> new workflow works fine
>
> Regards

You add the dependency in metadata.xml

Usually the dependency takes this form:

  profile-<package name>:default

But if I see it correctly, the CMFPlacefulWorkflow profile is not
called 'default' but 'CMFPlacefulWorkflow'.  So you do it like this:

<?xml version="1.0"?>
<metadata>
  <version>28</version>
  <dependencies>
    <dependency>profile-Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow</dependency>
  </dependencies>
</metadata>


--
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]


_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
francoise () Re: Re: A question regarding the definition.xml for a workflow
Reply Threaded More More options
Print post
Permalink
Thanks a lot, it worked fine !

I removed Extensions/Install.py and profiles/default/import-steps.xml
which did not seem necessary.

I did not find this indication, but with your answer I get the
following link with some explanation :
http://plone.org/products/plone/roadmap/195

Thanks you all

Regards

2009/10/7 Maurits van Rees <[hidden email]>:

> Françoise Conil, on 2009-10-07:
>> I did not succeed to install CMFPlacefulWorkflow as a dependency of my product.
>>
>> either by creating a Extensions/Install.py, because
>> CMFPlacefulWorkflow is an egg of the Products namespace I presume
>> nor by adding a <include package="Products.CMFPlacefulWorkflow" /> to
>> the configure.zcml of my package
>>
>> If someone know the right way ... I would be interested as I have no
>> more idea for this afternoon
>>
>> Otherwise, the import steps created for CMFPlacefulWorkflow with my
>> new workflow works fine
>>
>> Regards
>
> You add the dependency in metadata.xml
>
> Usually the dependency takes this form:
>
>  profile-<package name>:default
>
> But if I see it correctly, the CMFPlacefulWorkflow profile is not
> called 'default' but 'CMFPlacefulWorkflow'.  So you do it like this:
>
> <?xml version="1.0"?>
> <metadata>
>  <version>28</version>
>  <dependencies>
>    <dependency>profile-Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow</dependency>
>  </dependencies>
> </metadata>
>
>
> --
> Maurits van Rees | http://maurits.vanrees.org/
>            Work | http://zestsoftware.nl/
> "This is your day, don't let them take it away." [Barlow Girl]
>
>
> _______________________________________________
> Product-Developers mailing list
> [hidden email]
> http://lists.plone.org/mailman/listinfo/product-developers
>

_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers