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

Laurence Rowe l at lrowe.co.uk
Thu Dec 20 04:58:55 EST 2007


Put the pdb code in an external method, as shown in this article: 
http://www.zopemag.com/Issue009/Section_Articles/article_ZopeAndFlash.html?printit=1

You'll then be able to step into the guard checking.

Laurence


Marie Robichon wrote:
> Sorry, I omitted to point out that I am using Plone 2.1.4.
> 
> The solution you kindly pointed out to me is Zope3ish isn't it?? It is 
> sort of chinese to me....;-) I don't suppose with my version of Plone I 
> can do this ? If I can where do I put this code ?
> 
> I have tried other syntaxes in the guard expression box:
> 
> - "python:scripts.checkModifiedElement()" where a python script under 
> the scripts tags checks the length of getModified_element and returns 0 
> or 1 accordingly,
> 
> - python: python:len(state_change.object.getModified_element())>0
> 
> which do not seem to work either.
> 
> Thx
> 
> Marie
> 
> 
> 
> Laurence Rowe wrote:
>> 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
>>
>> _______________________________________________
>> 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
>>
> 
> _______________________________________________
> 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