Unit test for binary data display, refs #442

This commit is contained in:
Simon Willison 2019-05-03 12:43:59 -04:00
commit 01b3de5b66
4 changed files with 41 additions and 2 deletions

View file

@ -121,7 +121,9 @@ class RowTableShared(BaseView):
if plugin_display_value is not None:
display_value = plugin_display_value
elif isinstance(value, bytes):
display_value = jinja2.Markup("<{}&nbsp;bytes>".format(len(value)))
display_value = jinja2.Markup("&lt;Binary&nbsp;data:&nbsp;{}&nbsp;byte{}&gt;".format(
len(value), "" if len(value) == 1 else "s")
)
elif isinstance(value, dict):
# It's an expanded foreign key - display link to other row
label = value["label"]