mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Stop using firstresult=True on render_cell, refs #1425
See https://github.com/simonw/datasette/issues/1425#issuecomment-894883664
This commit is contained in:
parent
f3c9edb376
commit
a390bdf9ce
3 changed files with 18 additions and 10 deletions
|
|
@ -59,7 +59,7 @@ def publish_subcommand(publish):
|
|||
"""Subcommands for 'datasette publish'"""
|
||||
|
||||
|
||||
@hookspec(firstresult=True)
|
||||
@hookspec
|
||||
def render_cell(value, column, table, database, datasette):
|
||||
"""Customize rendering of HTML table cell values"""
|
||||
|
||||
|
|
|
|||
|
|
@ -354,16 +354,20 @@ class QueryView(DataView):
|
|||
display_value = value
|
||||
# Let the plugins have a go
|
||||
# pylint: disable=no-member
|
||||
plugin_value = pm.hook.render_cell(
|
||||
plugin_display_value = None
|
||||
for candidate in pm.hook.render_cell(
|
||||
value=value,
|
||||
column=column,
|
||||
table=None,
|
||||
database=database,
|
||||
datasette=self.ds,
|
||||
)
|
||||
plugin_value = await await_me_maybe(plugin_value)
|
||||
if plugin_value is not None:
|
||||
display_value = plugin_value
|
||||
):
|
||||
candidate = await await_me_maybe(candidate)
|
||||
if candidate is not None:
|
||||
plugin_display_value = candidate
|
||||
break
|
||||
if plugin_display_value is not None:
|
||||
display_value = plugin_display_value
|
||||
else:
|
||||
if value in ("", None):
|
||||
display_value = Markup(" ")
|
||||
|
|
|
|||
|
|
@ -191,15 +191,19 @@ class RowTableShared(DataView):
|
|||
|
||||
# First let the plugins have a go
|
||||
# pylint: disable=no-member
|
||||
plugin_display_value = pm.hook.render_cell(
|
||||
plugin_display_value = None
|
||||
for candidate in pm.hook.render_cell(
|
||||
value=value,
|
||||
column=column,
|
||||
table=table,
|
||||
database=database,
|
||||
datasette=self.ds,
|
||||
)
|
||||
plugin_display_value = await await_me_maybe(plugin_display_value)
|
||||
if plugin_display_value is not None:
|
||||
):
|
||||
candidate = await await_me_maybe(candidate)
|
||||
if candidate is not None:
|
||||
plugin_display_value = candidate
|
||||
break
|
||||
if plugin_display_value:
|
||||
display_value = plugin_display_value
|
||||
elif isinstance(value, bytes):
|
||||
display_value = markupsafe.Markup(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue