Commit 3ba427a5 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Don't apply Subscription Condition if state isn't draft or planned.

parent 878a6039
...@@ -2,6 +2,10 @@ from zExceptions import Unauthorized ...@@ -2,6 +2,10 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
if context.getSimulationState() not in ["draft", "planned"]:
# Don't modify it anymore
return
if subscription_condition_reference is not None: if subscription_condition_reference is not None:
# It would be better use some clever API here. # It would be better use some clever API here.
subscription_condition = context.portal_catalog.getResultValue( subscription_condition = context.portal_catalog.getResultValue(
...@@ -38,4 +42,5 @@ context.edit( ...@@ -38,4 +42,5 @@ context.edit(
start_date=now, start_date=now,
root_slave=subscription_configuration["shared"], root_slave=subscription_configuration["shared"],
subject_list=subscription_configuration["subject_list"], subject_list=subscription_configuration["subject_list"],
specialise_value=subscription_condition
) )
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