Commit 87b3cde3 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Directly use WorkflowTool to access time value.

Mixed commit:

  43b1ae1bc46b453e4553a9bc1077fe86e5db13bb
  2f05fe1b585d3ca736538b32269d36a410f5f7da
parent 4c780c08
...@@ -1862,7 +1862,7 @@ class Base( ...@@ -1862,7 +1862,7 @@ class Base(
def _setValue(self, id, target, spec=(), filter=None, portal_type=(), keep_default=1, def _setValue(self, id, target, spec=(), filter=None, portal_type=(), keep_default=1,
checked_permission=None): checked_permission=None):
getRelativeUrl = self.getPortalObject().portal_url.getRelativeUrl getRelativeUrl = self.getPortalObject().portal_url.getRelativeUrl
def cleanupCategory(path): def cleanupCategory(path):
# prevent duplicating base categories and storing "portal_categories/" # prevent duplicating base categories and storing "portal_categories/"
for start_string in ("portal_categories/", "%s/" % id): for start_string in ("portal_categories/", "%s/" % id):
...@@ -3249,13 +3249,14 @@ class Base( ...@@ -3249,13 +3249,14 @@ class Base(
pass pass
else: else:
max_date = None max_date = None
for history in history_list.itervalues(): portal_workflow = getToolByName(self.getPortalObject(), 'portal_workflow')
try: getStatusOf = portal_workflow.getStatusOf
date = history[-1]['time'] for key, _ in history_list.iteritems():
except (IndexError, KeyError, TypeError): status = getStatusOf(key, self)
continue if status is not None and status.has_key('time'):
if date > max_date: date = status['time']
max_date = date if date > max_date:
max_date = date
if max_date: if max_date:
# Return a copy of history time, to prevent modification # Return a copy of history time, to prevent modification
return DateTime(max_date) 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