from Products.ERP5Type.Log import log

context.logEntry("[NEW INGESTION]")
context.logEntry("Reference: %s" % reference)

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,
         'eof': eof,
         'specialise_reference': specialise_reference,
         'aggregate_data_set_reference': aggregate_data_set_reference,
         'resource_reference': 'fif'
       }

log("Returning dictionary: %s." % dict)
context.logEntry("Parameter dictionary: %s" % dict)

return dict
