From 424c0521de362aca849931792bdeda2ce71a87c7 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Sun, 15 Mar 2015 22:08:41 +0100 Subject: [PATCH] [gen] Bugfix: name clash when a transition is named 'comment'. [gen] Added AbstractWrapper::getHistoryComments allowing to collect comments of all history events of some type. --- fields/action.py | 6 +++--- fields/workflow.py | 3 ++- gen/ui/appy.js | 8 ++++---- gen/wrappers/__init__.py | 15 +++++++++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/fields/action.py b/fields/action.py index 25d8361..31cb4b2 100644 --- a/fields/action.py +++ b/fields/action.py @@ -36,7 +36,7 @@ class Action(Field): id=":formId" action=":zobj.absolute_url() + '/onExecuteAction'" style="display:inline"> - +

:_('workflow_comment') - +

@@ -379,7 +379,7 @@ class AbstractWrapper(object): style="display: inline" method="post"> - @@ -1291,6 +1291,17 @@ class AbstractWrapper(object): if condition: return event i -= 1 + def getHistoryComments(self, transition, xhtml=False): + '''Gets the concatenation of all comments for all transitions of type + p_transition in the object history.''' + res = [] + for event in self.history: + if event['action'] != transition: continue + if not event['comments']: continue + res.append(event['comments']) + br = xhtml and '
' or '\n' + return br.join(res) + def removeEvent(self, event): '''Removes p_event from this object's history''' res = []