From 70f0eeaeff83cb7c241bf5457d6f474216c6df54 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 13 Mar 2025 13:21:24 +0100 Subject: [PATCH] FIX: Fix reading in of caustom constants dictionary --- .../caosdb-server/scripting/bin/export_sample_csv.py | 1 + .../caosdb-server/scripting/bin/sample_helpers/utils.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py b/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py index 7311fc1..085c839 100755 --- a/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py +++ b/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py @@ -355,6 +355,7 @@ EXTRACTORS = use_custom_names({ "Longitude start": extract_lng_start, "Longitude stop": extract_lng_stop, "PDFReport": extract_pdf_id, + "PI": extract_person, "Sampling method": default_find, "Sphere": extract_sphere, "Start date": extract_start_date, diff --git a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/utils.py b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/utils.py index d047e6b..c6b6005 100644 --- a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/utils.py +++ b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/utils.py @@ -11,7 +11,12 @@ with open(os.path.join(Path(__file__).parent, "default_constants.yml")) as yaml_ if os.path.isfile(os.path.join(Path(__file__).parent, "constants.yml")): with open(os.path.join(Path(__file__).parent, "constants.yml")) as custom_yaml_file: - CONSTANTS.update(yaml.safe_load(custom_yaml_file)) + tmp_dict = yaml.safe_load(custom_yaml_file) + for key, value in tmp_dict.items(): + if isinstance(value, dict): + CONSTANTS[key].update(value) + else: + CONSTANTS[key] = value def get_entity_name(name: str): -- GitLab