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