Skip to content

Commit

Permalink
Additional work on #752.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Jul 31, 2024
1 parent 9f1f401 commit e43f4c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions workbench_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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.'
Expand Down

0 comments on commit e43f4c1

Please sign in to comment.