[Zope-CMF] CMF 1.3 roadmap / release schedule (preview)

Florent Guillaume fg@nuxeo.com
Thu, 21 Mar 2002 15:57:09 +0000 (UTC)


Tres Seaver  <tseaver@zope.com> wrote:
> I think that calling 'notifyCreated' from 'manage_afterAdd' is the
> Wrong Thing;  'manage_afterAdd' is about adding an object to a container,
> not about creation.

+1

> In the case of a "Cut" followed by a "Paste", the
> object is not logically "new" at all;  calling 'notifyCreated' in
> 'manage_afterAdd' is the source of Jeff Sasmor's tracker issue #342:
> 
>    http://www.zope.org/Products/PTK/Tracker/342

Ah, I'm seeing it only now, but DefaultWorkflow and DCWorkflow behave
differently there. DefaultWorkflow doesn't touch the workflow state
after a notifyCreated, but DCWorkflow reverts to the initial state.

Currently with you changes, DCWorkflow users will see a change in paste
semantics.

I like your proposed changes (haven't tested them though), but this
"revert to initial state upon add" behavior should be configurable.
There could be an "notifyAdded" in workflows, and DCWorkflow could have
a UI to define what to do with added documents. It could default to
"revert to initial state".

Florent


> It looks like OFS.CopySupport would actually do the RightThing if we
> called 'notifyCreated' only in 'manage_afterClone';  CopySupport only
> calls this hook if the paste is a "copy" operation, rathern than a
> "move" operation.
> 
> Florent, Jeff:  can you please try this patch to CMFCore.CatalogAware
> and see if it resolves your issues:
> 
> ################ begin patch #####################
> --- CMFCore/CMFCatalogAware.py	25 Feb 2002 16:08:01 -0000	1.2
> +++ CMFCore/CMFCatalogAware.py	21 Mar 2002 12:48:34 -0000
> @@ -54,10 +54,16 @@
>           #   Are we being added (or moved)?
>           #
>           if aq_base(container) is not aq_base(self):
> +            self.indexObject()
> +
> +    def manage_afterClone(self, item):
> +        """
> +            Add self to workflow, as we have just been cloned.
> +        """
> +        if aq_base(item) is aq_base(self):
>               wf = getToolByName(self, 'portal_workflow', None)
>               if wf is not None:
>                   wf.notifyCreated(self)
> -            self.indexObject()
> 
>       def manage_beforeDelete(self, item, container):
>           """
> ################# end patch ########################
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com