Sort content versions to get last one
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 11:48:25 +0200
changeset 64 f6dedcd5fb70
parent 63 120d60a27279
child 65 7a5bb2cb45d2
Sort content versions to get last one
src/pyams_sequence/reference.py
--- a/src/pyams_sequence/reference.py	Thu Aug 23 13:52:05 2018 +0200
+++ b/src/pyams_sequence/reference.py	Mon Aug 27 11:48:25 2018 +0200
@@ -99,9 +99,9 @@
 def get_version_in_state(content, state):
     """Check for versions in given status"""
     if handle_workflow and (IWorkflowVersion.providedBy(content) or IWorkflowManagedContent.providedBy(content)):
-        versions = IWorkflowVersions(content).get_versions(state)
+        versions = IWorkflowVersions(content).get_versions(state, sort=True)
         if versions:
-            content = versions[0]
+            content = versions[-1]
     if ISequentialIdInfo(content, None) is not None:
         return content
     else: