[Zope-CMF] Re: guard expression on workflow transition

Laurence Rowe l at lrowe.co.uk
Wed Dec 19 04:51:02 EST 2007


I use a view like this:

from zope.publisher.browser import BrowserView
from zope.component import getMultiAdapter
from AccessControl.SecurityManagement import getSecurityManager
import transaction

class PDBView(BrowserView):
     def __call__(self):
         sm = getSecurityManager()
         user = sm.getUser()
         context = self.context
         request = self.request
         import pdb; pdb.set_trace()
         self.context.portal_workflow.listActions(object=self.context)

registered like this:

     <browser:page
         for="*"
         name="pdb"
         class="testing.PDBView"
         permission="zope.Public"
         />

together with PDBDebugMode to step through the building of the workflow 
menu.

Hope that helps,

Laurence


Marie ROBICHON wrote:
> Hi,
> 
> I have a custom archetype for a seminar announcement.  When published
> this announcement runs a script to send an email to a mailing list. I
> have added to this content type a multiselection widget of checkboxes
> (called modified_element) enabling the user to indicate significant
> changes to this announcement, and a workflow transition which will send
> the email again announcing the changes (date, time etc.)
> 
> I would like to add a guard expression to this transition such that it
> is available only when the user has actually checked a box in the
> multiselection widget.
> 
> I have tried:
> 
> python:len(here.getModified_element())>0
> 
> but the workflow transition is still available in the dropdown.
> 
> I have updated the security settings.
> 
> Your help would be gratefully appreciated.
> 
> Thanks in advance
> 
> Marie
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests



More information about the Zope-CMF mailing list