[Zope] CMFBTreeFolder Behavior

Paul Winkler pw_lists at slinkp.com
Mon Feb 28 12:56:56 EST 2005


On Mon, Feb 28, 2005 at 12:28:15PM -0400, David Pratt wrote:
> Hi Paul. Thank you for your reply.  I think you are right on what is 
> happening with BTree and will try what you have suggested.  I was just 
> going to try looping over the data but thought of this as strange and 
> should consult the list.  I think the workflow approach to the problem 
> is likely the better one for sure since I already have the logic for 
> what I want to do with each image.  Can this approach work on images on 
> the uploads folder only without affecting the behavior of images across 
> the entire portal? 

The workflow will apply to all images, but:

> For example, if I set a boolean property on the 
> uploads folder and tested for it

That should do the trick. Use that as your guard condition
for the automatic transition.

It occurs to me that the workflow will basically keep
trying that guard condition for all Portal Images in your site
and won't stop until they leave their initial state.
There might be performance implications there :-)
There's ways around this, assuming that performance testing
reveals it is a problem (which should not be assumed). 

One way would be to add another state to your workflow,
let's call it NewImageState or something. Set this state to be the default
initial state. Have only one transition from it - the automatic
transition we discussed. If the image is in the Uploads folder, 
the automatic transition calls your processing script and
deletes the image, aborting the transition.
Otherwise, the transition's target state is whatever your
old initial state was (e.g. "private").
This way, the transition is called exactly once.

Note I have not tested this; deleting the object in
the middle of the transition strikes me as a bit funky -
it might "just work" or not.
Maybe this should be done as the transition's "before" script.

> I will look for the DCWorkflow docs in the meantime. Many thanks.

First hit on google:
http://www.zope.org/Members/hathawsh/DCWorkflow_docs
They're old but AFAIK still accurate.

THere's also a good chapter in Andy McKay's Plone book,
but IIRC it doesn't cover automatic transitions.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list