Only print the id attribute if it’s a string

If it’s something weird like an instance of a Python object let’s ignore
it (else we get invalid HTML like
`id='<notifications_utils.columns.Cell object at 0x1126f4e80>'`).
This commit is contained in:
Chris Hill-Scott
2019-06-17 17:09:45 +01:00
parent 14225027d2
commit 772066164c
2 changed files with 2 additions and 1 deletions

View File

@@ -45,7 +45,7 @@
{%- endmacro %}
{% macro row(id=None) -%}
<tr class="table-row" {% if id %}id="{{id}}"{% endif %}>
<tr class="table-row" {% if id and id is string %}id="{{id}}"{% endif %}>
{{ caller() }}
</tr>
{%- endmacro %}

View File

@@ -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