[Zope-CMF] automatic workflow transitions

Sam Brauer sam@webslingerz.com
Wed, 16 Jul 2003 10:23:53 -0400


I have a specific question about scripting automatic workflow 
transitions, and then a more general question.

Regarding scripting automatic transitions:

I have created a new transition (in a DCWorkflow) that I set up to be 
triggered Automatically.  I have created a script and set it as the 
"Script (before)" for the transition.  I would like for the script to 
allow the transition only if certain criteria are satisfied.

My problem is that I am unsure how the script can "veto" transition.
Based on some docs I read, I tried raising an exception if the criteria 
weren't met, but I wasn't sure what exception to raise.  I tried just 
raising the string "vetoed", but that bubbles up to the user.  On a 
hunch, I then tried returning 0 (if I didn't want the transition) or 1 
(if I did), but then the transition always occurred.  So evidentally my 
hunch was wrong and the return value is ignored.

Does anyone know the proper way to set up an automatic transition with 
veto power?


Now for a more general question:

I have a folder in a CMF site the contents of which should only be 
viewable by authenticated users.  That means that the content also 
shouldn't show up in search results unless the user is logged in.
What is the best way to accomplish this goal?

(I tried various approaches already, and so far the best I've been able 
to come up with is a new "members-only" state.  After setting up that 
new state, I tried to create a new transition from the published state 
to the members-only state that is triggered if the content is under the 
proper folder.  However, I can't figure out how to make the automatic 
transition not occur if the content is in some other folder.  Maybe 
someone can offer a better/easier way to accomplish my goal...)


Thank you,
- Sam Brauer