Applied some fixes suggested by @withshubh in #1260

This commit is contained in:
Simon Willison 2021-03-28 17:20:55 -07:00
commit d579fcf4f7
2 changed files with 3 additions and 3 deletions

View file

@ -317,7 +317,7 @@ class Datasette:
loader=template_loader, autoescape=True, enable_async=True
)
self.jinja_env.filters["escape_css_string"] = escape_css_string
self.jinja_env.filters["quote_plus"] = lambda u: urllib.parse.quote_plus(u)
self.jinja_env.filters["quote_plus"] = urllib.parse.quote_plus
self.jinja_env.filters["escape_sqlite"] = escape_sqlite
self.jinja_env.filters["to_css_class"] = to_css_class
# pylint: disable=no-member
@ -767,7 +767,7 @@ class Datasette:
hook_renderers = []
# pylint: disable=no-member
for hook in pm.hook.register_output_renderer(datasette=self):
if type(hook) == list:
if type(hook) is list:
hook_renderers += hook
else:
hook_renderers.append(hook)

View file

@ -196,7 +196,7 @@ def permission_allowed(actor, action):
elif action == "this_is_denied":
return False
elif action == "view-database-download":
return (actor and actor.get("can_download")) or None
return actor.get("can_download") if actor else None
@hookimpl