Re: [Zope-CMF] workflow and deletes

2007-02-14 Thread Dieter Maurer
Miles wrote at 2007-2-14 14:10 +:
> ...
>I'd like my workflow to be notified when an object is deleted, so it has 
>the chance to veto deletion, or do some tidy-up on related objects. 
>However at the moment, the workflow tool is not wired up to react to 
>deletion at all.

You might be able to proceed as follows:

  *  You restrict the "Delete objects" permission such
 that normal users are no longer able to delete objects

  *  You implement a script that performs the object deletion.
 You give it a proxy role that it *can* delete objects.

  *  You add a "delete" transition to your workflows that
 calls your script to delete the object.

 Due to an outrageously long standing bug, proxy roles
 are not working for "DCWorkflow" workflow scripts.
 You need to use a second script that calls your script.



-- 
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] workflow and deletes

2007-02-14 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 14 Feb 2007, at 15:10, Miles wrote:
I was wondering how - if at all - others have made a workflow react  
to deletion of an object.  Is there any call for some hook/event  
that allows workflows to respond to this event?  It seems a bit odd  
to me that workflows are carefully notified of creation via  
notifyCreated, but can't do anything about deletions.


The standard workflows shipping with CMF simply never cared, no one  
had the need. I believe the same is true for the standard Plone  
workflows.



I thought of creating a 'delete' workflow action, but that would  
cause problems if ever the object were deleted via a different  
mechanism (e.g. zmi).


For older CMF versions you'd normally define your own  
manage_beforeDelete to do whatever you want it to do just before the  
onject is deleted.


In CMF-trunk, the future CMF 2.1, this has been changed to use events  
instead. Take a look at CMFCore/events.zcml for how to register an  
event handler and CMFCore/CMFCatalogAware.py to see some handlers.  
Obviously this is a much better solution since you don't need to  
change existing code, you just need to write a handler function and  
register it using zcml.


jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFF0y4CRAx5nvEhZLIRAgOyAJ9t+poUDsWqiib5RTeQEAvgGTvVyQCfaDxg
CFfUEbRjGmZufvpnDSK5Il8=
=yOdI
-END PGP SIGNATURE-
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests