Commit 480aecf6 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Directly use WorkflowTool to access time value.

Mixed commit:

  43b1ae1b
  2f05fe1b
parent dce32e0b
......@@ -1805,7 +1805,7 @@ class Base( CopyContainer,
def _setValue(self, id, target, spec=(), filter=None, portal_type=(), keep_default=1,
checked_permission=None):
getRelativeUrl = self.getPortalObject().portal_url.getRelativeUrl
def cleanupCategory(path):
# prevent duplicating base categories and storing "portal_categories/"
for start_string in ("portal_categories/", "%s/" % id):
......@@ -3217,13 +3217,14 @@ class Base( CopyContainer,
pass
else:
max_date = None
for history in history_list.itervalues():
try:
date = history[-1]['time']
except (IndexError, KeyError, TypeError):
continue
if date > max_date:
max_date = date
portal_workflow = getToolByName(self.getPortalObject(), 'portal_workflow')
getStatusOf = portal_workflow.getStatusOf
for key, _ in history_list.iteritems():
status = getStatusOf(key, self)
if status is not None and status.has_key('time'):
date = status['time']
if date > max_date:
max_date = date
if max_date:
# Return a copy of history time, to prevent modification
return DateTime(max_date)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment