Commit be176741 authored by Roque Porchetto's avatar Roque Porchetto

erp5_wendelin_telecom_ingestion: slash ( / ) reference separator and directory tree

parent 3728c446
......@@ -3,12 +3,13 @@ from Products.ERP5Type.Log import log
context.logEntry("[NEW INGESTION]")
context.logEntry("Reference: %s" % reference)
record = reference.rsplit('.')
filename = record[2] if (len(record) >= 5) else reference
extension = record[3] if (len(record) >= 5) else "fif"
eof = record[4] if (len(record) >= 5) else "eof"
specialise_reference = record[0] if (len(record) >= 5) else "default"
aggregate_data_set_reference = record[1] if (len(record) >= 5) else "default"
record = reference.rsplit('/')
length = len(record)
specialise_reference = record[0] if (length >= 5) else "default"
aggregate_data_set_reference = record[1] if (length >= 5) else "default"
filename = '/'.join(record[2:-2]) if (length >= 5) else reference
extension = record[length-2] if (length >= 5) else "fif"
eof = record[length-1] if (length >= 5) else "eof"
dict = { 'filename': filename,
'extension': extension,
......
......@@ -12,11 +12,11 @@ for data_set in portal_catalog(**kw_dict):
if not data_set.getReference().endswith("_invalid"):
context.logEntry("Invalidating data set and dependencies for: " + data_set.getReference())
log("Ivalid Dataset: " + str(data_set.getReference()))
reference_query = Query(**{'reference': data_set.getReference()+'_%'})
reference_query = Query(**{'reference': data_set.getReference()+'/%'})
kw_dict = {"portal_type": "Data Stream",
"query": reference_query}
for data_stream in portal_catalog(**kw_dict):
if data_stream.getReference().startswith(data_set.getReference()+'_'):
if data_stream.getReference().startswith(data_set.getReference()+'/'):
log("Related data stream: " + data_stream.getReference())
portal.ERP5Site_invalidateIngestionObjects(data_stream.getReference())
log("Invalidating data set")
......
......@@ -9,7 +9,7 @@ portal_catalog = portal.portal_catalog
try:
# remove supplier and eof from reference
reference = '_'.join(reference.split('.')[1:-1]) #'_'.join(reference.split('.')[:-1])
reference = '/'.join(reference.split('/')[1:-1]) #'_'.join(reference.split('.')[:-1])
log("Reference: " + reference)
context.logEntry("Data Ingestion reference: %s" % reference)
......@@ -18,7 +18,7 @@ try:
resource_reference = movement_dict.get('resource_reference', None)
specialise_reference = movement_dict.get('specialise_reference', None)
dataset_reference = movement_dict.get('aggregate_data_set_reference', None)
data_ingestion_id = '%s_%s_%s' %(specialise_reference, data_ingestion_reference, today_string)
data_ingestion_id = '%s_%s_%s' %(specialise_reference, data_ingestion_reference.replace("/","_"), today_string)
context.logEntry("Data Ingestion ID: %s" % reference)
# search for applicable data ingestion
......
......@@ -14,8 +14,12 @@ try:
context.logEntry("Attempt to do a new ingestion with reference: %s" % reference)
# remove supplier and eof from reference
data_ingestion_reference = '_'.join(reference.split('.')[1:-1])
EOF = reference.split('.')[-1]
data_ingestion_reference = '/'.join(reference.split('/')[1:-1])
EOF = reference.split('/')[-1]
if data_ingestion_reference is "":
context.logEntry("[ERROR] Data Ingestion reference is not well formated")
raise ValueError("Data Ingestion reference is not well formated")
data_ingestion = portal_catalog.getResultValue(
portal_type = 'Data Ingestion',
......
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