Commit 9ef4b3bb authored by Łukasz Nowak's avatar Łukasz Nowak

Avoid failures in case of bad sla xml.

parent 37ea1e21
......@@ -75,13 +75,18 @@ def assignComputerPartition(software_instance):\n
if not person.Person_isAllowedToAllocate():\n
raise Unauthorized(\'Allocation disallowed\')\n
\n
computer_partition_relative_url = person.Person_restrictMethodAsShadowUser(\n
shadow_document=person,\n
callable_object=person.Person_findPartition,\n
argument_list=[software_instance.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
try:\n
sla_dict = software_instance.getSlaXmlAsDict()\n
except Exception:\n
# Note: it is impossible to import module exceptions from python scripts\n
computer_partition_relative_url = None\n
else:\n
computer_partition_relative_url = person.Person_restrictMethodAsShadowUser(\n
shadow_document=person,\n
callable_object=person.Person_findPartition,\n
argument_list=[software_instance.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), sla_dict])\n
return computer_partition_relative_url\n
return (None, None)\n
\n
software_instance = context\n
if software_instance.getValidationState() != \'validated\' \\\n
......
186
\ No newline at end of file
187
\ 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