Commit 7992770a authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code because exist more line that need check if exist the transition start_requested

parent cd61ba08
......@@ -55,6 +55,7 @@
from DateTime import DateTime\n
person = state_change[\'object\']\n
portal = person.getPortalObject()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
# Get required arguments\n
kwargs = state_change.kwargs\n
software_release_url_string = state_change.kwargs[\'software_release\']\n
......@@ -114,9 +115,9 @@ if (request_software_instance is None):\n
title=software_title,\n
activate_kw={\'tag\': tag},\n
)\n
if state == \'started\':\n
if state == \'started\' and isTransitionPossible(request_software_instance, "start_requested"):\n
software_instance.startRequested()\n
elif state == \'stopped\':\n
elif state == \'stopped\' and isTransitionPossible(request_software_instance, "stop_requested"):\n
software_instance.stopRequested() \n
\n
software_release_document = context.portal_catalog.getResultValue(\n
......@@ -177,7 +178,6 @@ if (request_software_instance is None):\n
# Find Computer partition\n
# XXX Link subscript to open order\n
else:\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
# Update existing software instance\n
request_software_instance.edit(\n
text_content=instance_xml,\n
......
390
\ No newline at end of file
391
\ No newline at end of file
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