From e43f4c1df0fc96b7106c9c5349cbc8b0f7d93bfc Mon Sep 17 00:00:00 2001 From: Mark Jordan Date: Wed, 31 Jul 2024 11:47:23 -0700 Subject: [PATCH] Additional work on #752. --- workbench_utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/workbench_utils.py b/workbench_utils.py index 2c90ef6..712280a 100644 --- a/workbench_utils.py +++ b/workbench_utils.py @@ -6230,11 +6230,6 @@ def create_term(config, vocab_id, term_name, term_csv_row=None): string|boolean The term ID, or False term was not created. """ - if vocab_id in config["protected_vocabularies"]: - logging.warning( - f'Term "{term_name}" is not in its designated vocabulary ({vocab_id}) and will not be added since the vocabulary is registered in the "protected_vocabularies" config setting.' - ) - return False # Check to see if term exists; if so, return its ID, if not, proceed to create it. tid = find_term_in_vocab(config, vocab_id, term_name) if value_is_numeric(tid): @@ -6256,6 +6251,12 @@ def create_term(config, vocab_id, term_name, term_csv_row=None): ) return tid + if vocab_id in config["protected_vocabularies"]: + logging.warning( + f'Term "{term_name}" is not in its designated vocabulary ({vocab_id}) and will not be added since the vocabulary is registered in the "protected_vocabularies" config setting.' + ) + return False + if config["allow_adding_terms"] is False: logging.warning( f'Term "{term_name}" does not exist in the vocabulary "{vocab_id}". To create new taxonomy terms, you must add "allow_adding_terms: true" to your configuration file.'