From 772066164c1ed172476d94693ca02ef6b20b6b60 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 17 Jun 2019 17:09:45 +0100 Subject: [PATCH] =?UTF-8?q?Only=20print=20the=20id=20attribute=20if=20it?= =?UTF-8?q?=E2=80=99s=20a=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If it’s something weird like an instance of a Python object let’s ignore it (else we get invalid HTML like `id=''`). --- app/templates/components/table.html | 2 +- tests/app/main/views/test_send.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 656ef1c47..0571fc5d4 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -45,7 +45,7 @@ {%- endmacro %} {% macro row(id=None) -%} - + {{ caller() }} {%- endmacro %} diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 60750649d..313a7e44d 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -704,6 +704,7 @@ def test_upload_valid_csv_shows_preview_and_table( ]): for index, cell in enumerate(row): row = page.select('table tbody tr')[row_index] + assert 'id' not in row assert normalize_spaces(str(row.select('td')[index + 1])) == cell