diff --git a/mo/web/table.py b/mo/web/table.py index 8ce5bfb73109dfb028350bbe42d269d76d5ac339..fcd476a55301bf12e88a520f87d2795a9be224f1 100644 --- a/mo/web/table.py +++ b/mo/web/table.py @@ -37,7 +37,7 @@ class Cell: return self.text def to_html(self) -> str: - return escape(self.text) + return '<td>' + escape(self.text) class Row: @@ -63,7 +63,7 @@ class CellLink(Cell): self.hint = hint def to_html(self) -> str: - a = '<a href="' + escape(self.url) + '"' + a = '<td><a href="' + escape(self.url) + '"' if self.hint: a += ' title="' + escape(self.hint) + '"' return a + '>' + escape(self.text) + '</a>' @@ -81,7 +81,7 @@ class CellCheckbox(Cell): self.checked = checked def to_html(self) -> str: - ch = f'<input type="checkbox" name="{self.name}" value="{self.value}"' + ch = f'<td><input type="checkbox" name="{self.name}" value="{self.value}"' if self.checked: ch += ' checked' return ch + '>' @@ -113,10 +113,9 @@ class Table: for c in self.columns: val = r.get(c.key) if isinstance(val, Cell): - vals = val.to_html() + tab.append(val.to_html()) else: - vals = escape(str(val)) - tab.append(f'\t<td>{vals}') + tab.append(f'\t<td>{escape(str(val))}') tab.append('</table>') if self.show_downlink: