[Zope-CMF] DCWorkflow: matching a catalogged variable with user id in woklist
Florent Guillaume
fg@nuxeo.com
Thu, 21 Mar 2002 15:44:35 +0000 (UTC)
I've always found the worklists to be too limited for my needs anyway.
Your changes look ok though.
Except that the "if self.isAnonymous:" part isn't needed, anonymous users
will get a 'Anonymous User' from getMemberId.
Florent
Luca Olivetti <luca@wetron.es> wrote:
> Hi,
> I have a catalogged variable in my workflow that stores the id of the user
> to whom the
> task has been assigned.
> In his/her worklist I want to show only items assigned to him/her (like, match
> review_state to 'assigned' and match assigned_to to '%(user_id)s'), but, in
> the default
> implementation, it's only possible to match a variable with a literal string so
> %(user_id)s won't map to the user id (besides, there's no user_id attribute in
> ActionInformation).
> I had to do a couple of small changes but since I consider myself a newbie I
> cannot
> evaluate all ramifications:
>
> --- DCWorkflow/DCWorkflow.py.orig Thu Mar 21 12:33:30 2002
> +++ DCWorkflow/DCWorkflow.py Thu Mar 21 12:34:42 2002
> @@ -218,7 +218,7 @@
> catalog = getToolByName(self, 'portal_catalog')
> dict = {}
> for k, v in qdef.var_matches.items():
> - dict[k] = v
> + dict[k] = v % info
> searchres = apply(catalog.searchResults, (), dict)
> if not searchres:
> continue
> --- CMFCore/ActionsTool.py.orig Thu Mar 21 12:35:02 2002
> +++ CMFCore/ActionsTool.py Thu Mar 21 12:46:21 2002
> @@ -37,6 +37,10 @@
> self.portal = portal = aq_parent(aq_inner(tool))
> membership = getToolByName(tool, 'portal_membership')
> self.isAnonymous = membership.isAnonymousUser()
> + if self.isAnonymous:
> + self.user_id = 'Guest'
> + else:
> + self.user_id = membership.getAuthenticatedMember().getMemberId()
> self.portal_url = portal.absolute_url()
> if folder is not None:
> self.folder_url = folder.absolute_url()
>
>
> These changes seem not to produce adverse effects, so I'm asking if it's
> possible to
> incorporate this patches in DCWorkflow/CMFCore (I see that in the cvs
> version of CMFCore
> the functionality of the ActionInformation class has been moved to the oai
> class in
> ActionInformation.py).
> Or plese tell me if I missed the boat and the above patch is dangerous or
> useless.
>
> Bye
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10 http://nuxeo.com mailto:fg@nuxeo.com