Commit c2db525f authored by Roque Porchetto's avatar Roque Porchetto

Workaround for "repeated data sets" bug.

parent 085b15fa
portal = context.getPortalObject() portal = context.getPortalObject()
portal_catalog = portal.portal_catalog portal_catalog = portal.portal_catalog
data_set = portal_catalog.getResultValue( #data_set = portal_catalog.getResultValue(
portal_type = "Data Set", # portal_type = "Data Set",
reference = data_set_reference) # reference = data_set_reference)
#if data_set is None:
# return []
if data_set is None: ################################ workaround for "multiple-datasets" bug ################################
query_dict = {
"portal_type": "Data Set",
"reference" : data_set_reference}
data_set_list = portal_catalog(**query_dict)
if len(data_set_list) == 0:
return [] return []
def belongsToDatasets(line):
for data_set in data_set_list:
if line.getAggregateDeviceConfiguration() == "data_set_module/" + str(data_set.getId()):
return True
return False
################################ workaround for "multiple-datasets" bug ################################
query_dict = { query_dict = {
"portal_type": "Data Ingestion Line", "portal_type": "Data Ingestion Line",
"resource_portal_type": "Data Product", "resource_portal_type": "Data Product",
...@@ -16,7 +30,8 @@ query_dict = { ...@@ -16,7 +30,8 @@ query_dict = {
data_stream_list = [] data_stream_list = []
for line in portal_catalog(**query_dict): for line in portal_catalog(**query_dict):
if line.getAggregateDeviceConfiguration() == "data_set_module/" + str(data_set.getId()): if belongsToDatasets(line):
#if line.getAggregateDeviceConfiguration() == "data_set_module/" + str(data_set.getId()):
for item in line.getAggregateSet(): for item in line.getAggregateSet():
if "data_stream_module/" in item: if "data_stream_module/" in item:
data_stream = context.restrictedTraverse(item) data_stream = context.restrictedTraverse(item)
......
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