From 9fe3ca84e643510342de540d60d3fbbe1c30b646 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 24 Sep 2021 18:08:17 +0100 Subject: [PATCH] cove_360.views: Custom msg for conversion warnings about publisher field Depends on: https://github.com/OpenDataServices/flatten-tool/pull/389 https://github.com/OpenDataServices/lib-cove/pull/91 --- cove/cove_360/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cove/cove_360/views.py b/cove/cove_360/views.py index 76be5a5..7151b02 100644 --- a/cove/cove_360/views.py +++ b/cove/cove_360/views.py @@ -65,8 +65,15 @@ def explore_360(request, pk, template='cove_360/explore.html'): lib_cove_config=lib_cove_config)) else: + def conversion_warning_hook(w): + if hasattr(w.message, "path_till_now"): + if w.message.path_till_now == "publisher": + return 'Just "Publisher" should not appear in the Meta tab, did you mean "Publisher:Name"?' + else: + return w + context.update(convert_spreadsheet(upload_dir, upload_url, file_name, file_type, lib_cove_config, schema_360.schema_url, - schema_360.pkg_schema_url)) + schema_360.pkg_schema_url, conversion_warning_hook=conversion_warning_hook)) with open(context['converted_path'], encoding='utf-8') as fp: json_data = json.load(fp, parse_float=Decimal)