From 607c4f53e8edae2f5d0c52c9d030ef51f62d226b Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 5 Jan 2021 15:01:34 -0600 Subject: [PATCH] Break the error block into functions --- src/pgwui_common/templates/auth_base.mak | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pgwui_common/templates/auth_base.mak b/src/pgwui_common/templates/auth_base.mak index 243030e..132055f 100644 --- a/src/pgwui_common/templates/auth_base.mak +++ b/src/pgwui_common/templates/auth_base.mak @@ -63,17 +63,32 @@ % endif -<%block name="error_report"> +<%doc> Error reporting + +<%def name="error_file_summary(e_cnt, lines, filepath, relation)"> % if e_cnt:

${e_cnt} errors % if lines == UNDEFINED or lines == 0: found. % else: - found in a file of ${lines} lines. (Including column headings.) + found + % if relation is None: + in + % else: + while inserting data into ${relation} from + % endif + % if filepath is None: + a file of + % else: + file ${filepath}, containing + % endif + ${lines} lines. (Including column headings.) % endif

% endif + +<%def name="error_items(errors)"> % for error in errors: ## Get error attributes @@ -129,6 +144,11 @@ % endif % endfor + + +<%block name="error_report"> + <% self.error_file_summary(e_cnt, lines, None, None) %> + <% self.error_items(errors) %> <%def name="upload_form(extra_rows=[], upload_nulls=True)"> -- 2.34.1