Commit 0f63ea28 authored by Roque Porchetto's avatar Roque Porchetto

erp5_wendelin_telecom_ingestion: bug fix in data descriptor invalidation

parent 300a725f
......@@ -72,7 +72,7 @@ for line_data_ingestion in portal_catalog(**query_dict):
module = portal.getDefaultModule(item_type)
item = module.newContent(portal_type = item_type,
title = data_ingestion.getTitle(),
#title = data_ingestion.getReference(),
id = data_ingestion.getId(),
reference = data_ingestion.getReference(),
version = '001')
if "Data Descriptor" not in item_type:
......
......@@ -20,18 +20,26 @@ try:
if data_analysis.getSimulationState() != 'stopped':
return '{"metadata":"Metadata not ready yet, please wait some minutes."}'
query = Query(portal_type="Data Descriptor")
content = None
try:
url = 'data_descriptor_module/' + data_ingestion.getId()
data_descriptor = context.restrictedTraverse(url)
except Exception as e:
# backward compatibility
log("ERROR while looking for data descriptor with id %s : %s" % (str(data_ingestion.getId()), str(e)))
query = Query(portal_type="Data Descriptor")
data_descriptor = None
for document in portal_catalog(query=query):
if document.reference == reference:
data_descriptor = document
if data_descriptor is None:
return '{"metadata":"No metadata descriptor found for this file"}'
for document in portal_catalog(query=query,
sort_on=(('id', 'DESC', 'int'),)):
if document.reference == reference:
content = document.getTextContent()
if content is not None:
return content
else:
return '{"metadata":"No metadata available for this type of file yet"}'
return '{"metadata":"No metadata descriptor found for this file"}'
content = data_descriptor.getTextContent()
if content is not None:
return content
else:
return '{"metadata":"No metadata available for this type of file yet"}'
except Exception as e:
log("Error getting data descriptor content: " + str(e))
......
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