diff --git a/portality/bll/services/application.py b/portality/bll/services/application.py index ced41804cc..797fdfa992 100644 --- a/portality/bll/services/application.py +++ b/portality/bll/services/application.py @@ -692,7 +692,13 @@ def validate_update_csv(self, file_path, account: models.Account): if not fc.validate(): for k, v in fc.form.errors.items(): question = Journal2PublisherUploadQuestionsXwalk.q(k) - pos = header_row.index(question) + try: + pos = header_row.index(question) + except: + # this is because the validation is on a field which is not in the csv, so it must + # be due to an existing validation error in the data, and not something the publisher + # can do anything about + continue now = row.get(question) was = [v for q, v in journal_questions if q == question][0] if isinstance(v[0], dict): diff --git a/portality/scripts/journals_update_via_csv.py b/portality/scripts/journals_update_via_csv.py index a9073a2325..c87f252612 100644 --- a/portality/scripts/journals_update_via_csv.py +++ b/portality/scripts/journals_update_via_csv.py @@ -7,15 +7,11 @@ If environment variable DOAJ_CSV_NOTE is set, the supplied note will be applied to all created update requests. -Input CSV must have ID as first column, then the JournalCSV columns following. Turn off strict checking with -f to allow -updates from a mis-shapen CSV file. - -NOTE: depending on which fields are required, we may need to add new value transformations in the xwalk from - CSV columns questions back to the form. See portality/crosswalks/journal_questions.py +Input CSV is a standard DOAJ journal CSV Usage: e.g. for a dry-run first with a malformed CSV export DOAJ_CSV_NOTE='UR autogenerated after publisher CSV uploaded. Change to URL and/or APCS.' -DOAJENV=production python -u journals_update_via_csv.py -i -o -s -f -d | tee +DOAJENV=production python -u journals_update_via_csv.py -i -a adminuser -d | tee Check the report for errors and the output for expected changes, then run without -d to apply the updates. """