From 13734bd4a404bc4e028f69b5e3e8191a231a389f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DA=20ROCHA?= <sebastien@da-rocha.net> Date: Mon, 5 Jul 2021 16:15:44 +0200 Subject: [PATCH] ignore geonetwork new fields --- workers/metadata_processor.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/workers/metadata_processor.py b/workers/metadata_processor.py index 32ce67c..839dd22 100644 --- a/workers/metadata_processor.py +++ b/workers/metadata_processor.py @@ -65,16 +65,19 @@ def list_to_dictlist( the_input, the_context=None ): out_item = {} for k, line in enumerate(in_item_split): - if line != "": - if the_context != None: - out_item[ dictionary[the_context][k] ] = line + if the_context and k in dictionary[the_context].keys(): + if line != "": + if the_context and dictionary[the_context].get(k): + out_item[ dictionary[the_context][k] ] = line + else: + out_item[ k ] = line else: - out_item[ k ] = line - else: - out_item[ dictionary[the_context][k] ] = 'null' + if dictionary[the_context].get(k): + out_item[ dictionary[the_context][k] ] = 'null' - logging.debug(the_context) - logging.debug(out_item) + logging.debug("context : %s", the_context) + logging.debug("input: %s", in_item) + logging.debug("result : %s", out_item) # appending a hash value of the item can be useful at client-side, # as it allows one to identify entities that are common to multiple datasets... @@ -420,6 +423,6 @@ if __name__ == '__main__': logging.info('Waiting for RabbitMQ to be reachable...') time.sleep(5) except Exception as e: - logging.error(e) + logging.exception("General error (Aborting): %s", e) time.sleep(5) exit(1) -- GitLab