Commit c53925b1 authored by Paul Graydon's avatar Paul Graydon

wendelin_telecom_base: Update ERP5Site_registerOrs parameter name

parent d29e4e3e
......@@ -14,29 +14,29 @@ response_dict = {}
# Check if ORS is already registered
data_acquisition_unit = context.portal_catalog.getResultValue(
portal_type='Data Acquisition Unit',
reference=ors_tag,
reference=fluentbit_tag,
validation_state='validated'
)
if data_acquisition_unit:
error_msg = "ORS with tag %s already exists." % ors_tag
error_msg = "ORS with tag %s already exists." % fluentbit_tag
response_dict = dict(error_msg=error_msg)
return json.dumps(response_dict)
ors_tag_components = ors_tag.split('_')
if len(ors_tag_components) != 3:
error_msg = "Invalid ORS tag %s found" % ors_tag
fluentbit_tag_components = fluentbit_tag.split('_')
if len(fluentbit_tag_components) != 3:
error_msg = "Invalid ORS tag %s found" % fluentbit_tag
response_dict = dict(error_msg=error_msg)
return json.dumps(response_dict)
ors_hostname, ors_comp_id = ors_tag_components[0], ors_tag_components[1]
ors_tag_prefix = '%s_%s' % (ors_hostname, ors_comp_id)
ors_hostname, ors_comp_id = fluentbit_tag_components[0], fluentbit_tag_components[1]
fluentbit_tag_prefix = '%s_%s' % (ors_hostname, ors_comp_id)
# Detect the case where an existing ORS has changed the last component of its tag:
# Search for all Data Acquisition Units with the same first two tag components and get their related destination_project
related_data_acquisition_unit_list = [
related_data_acquisition_unit for related_data_acquisition_unit \
in portal.data_acquisition_unit_module.contentValues(filter={'portal_type': 'Data Acquisition Unit'}) \
if related_data_acquisition_unit.getReference().startswith(ors_tag_prefix)
if related_data_acquisition_unit.getReference().startswith(fluentbit_tag_prefix)
]
destination_project = None
if related_data_acquisition_unit_list:
......@@ -55,7 +55,7 @@ if related_data_acquisition_unit_list:
data_acquisition_unit = portal.data_acquisition_unit_module.newContent(
portal_type='Data Acquisition Unit',
reference=ors_tag
reference=fluentbit_tag
)
data_acquisition_unit.validate()
data_supply = data_acquisition_unit.DataAcquisitionUnit_createOrsDataSupply(batch=1)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>ors_tag</string> </value>
<value> <string>fluentbit_tag</string> </value>
</item>
<item>
<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