Commit 98947883 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Fix query to catalog and allow re-apply conditions to the subscription

parent 91d60711
...@@ -2,10 +2,19 @@ from zExceptions import Unauthorized ...@@ -2,10 +2,19 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
subscription_condition = context.portal_catalog( if subscription_condition_reference is not None:
portal_type="Subscription Condition", # It would be better use some clever API here.
reference=subscription_reference, subscription_condition = context.portal_catalog.getResultValue(
validation_state="validated") portal_type="Subscription Condition",
reference=subscription_condition_reference,
validation_state="validated")
else:
subscription_condition = context.getSpecialiseValue()
if subscription_condition is None:
raise ValueError(
"It was not possible to find the appropriate Condition %s for this Subscription" \
% subscription_condition_reference)
# Get Subscription condition for this Subscription Request # Get Subscription condition for this Subscription Request
subscription_configuration = { subscription_configuration = {
......
...@@ -50,7 +50,15 @@ ...@@ -50,7 +50,15 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>subscription_reference, REQUEST=None</string> </value> <value> <string>subscription_condition_reference=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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