home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

23 rows where "updated_at" is on date 2020-10-31 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: issue_url, created_at (date), updated_at (date)

issue 12

  • PrefixedUrlString mechanism broke everything 6
  • Table actions menu on view pages, not on query pages 4
  • latest.datasette.io should include plugins from fixtures 3
  • load_template hook doesn't work for include/extends 2
  • Incorrect URLs when served behind a proxy with base_url set 1
  • Fix issues relating to base_url 1
  • How should datasette.client interact with base_url 1
  • Add documentation on serving Datasette behind a proxy using base_url 1
  • extra_js_urls and extra_css_urls should respect base_url setting 1
  • A new section in the docs about how Datasette handles BLOB columns 1
  • load_template() example in documentation showing loading from a database 1
  • database_actions plugin hook 1

user 1

  • simonw 23

author_association 1

  • OWNER 23
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
720003026 https://github.com/simonw/datasette/issues/1077#issuecomment-720003026 https://api.github.com/repos/simonw/datasette/issues/1077 MDEyOklzc3VlQ29tbWVudDcyMDAwMzAyNg== simonw 9599 2020-10-31T23:48:21Z 2020-10-31T23:50:07Z OWNER

Needed by https://github.com/simonw/datasette-backup/issues/6

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
database_actions plugin hook 733829385  
719994676 https://github.com/simonw/datasette/issues/1047#issuecomment-719994676 https://api.github.com/repos/simonw/datasette/issues/1047 MDEyOklzc3VlQ29tbWVudDcxOTk5NDY3Ng== simonw 9599 2020-10-31T22:11:25Z 2020-10-31T22:11:25Z OWNER

https://docs.datasette.io/en/latest/binary_data.html

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
A new section in the docs about how Datasette handles BLOB columns 728895233  
719988113 https://github.com/simonw/datasette/issues/1027#issuecomment-719988113 https://api.github.com/repos/simonw/datasette/issues/1027 MDEyOklzc3VlQ29tbWVudDcxOTk4ODExMw== simonw 9599 2020-10-31T21:03:37Z 2020-10-31T21:03:37Z OWNER

On my Mac, I run:

datasette . -p 8009 --config base_url:/datasette-prefix/

Then I edited /usr/local/etc/httpd/httpd.conf and add this section: LoadModule proxy_module lib/httpd/modules/mod_proxy.so LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so ProxyPass /datasette-prefix/ http://localhost:8009/datasette-prefix/ I ran Apache in the foreground like so:

apachectl -X

Now hitting http://localhost:8081/datasette-prefix/fixtures/compound_three_primary_keys worked!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add documentation on serving Datasette behind a proxy using base_url 722758132  
719986922 https://github.com/simonw/datasette/issues/1023#issuecomment-719986922 https://api.github.com/repos/simonw/datasette/issues/1023 MDEyOklzc3VlQ29tbWVudDcxOTk4NjkyMg== simonw 9599 2020-10-31T20:51:01Z 2020-10-31T20:51:01Z OWNER

This should all be working correctly now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Fix issues relating to base_url 722673818  
719986904 https://github.com/simonw/datasette/issues/838#issuecomment-719986904 https://api.github.com/repos/simonw/datasette/issues/838 MDEyOklzc3VlQ29tbWVudDcxOTk4NjkwNA== simonw 9599 2020-10-31T20:50:41Z 2020-10-31T20:50:41Z OWNER

OK, this should be working now. You can use the datasette.urls.static_plugins() method to generate the correct URLs in the extra_css_urls plugin hook: https://docs.datasette.io/en/latest/internals.html#datasette-urls

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Incorrect URLs when served behind a proxy with base_url set 637395097  
719986800 https://github.com/simonw/datasette/issues/1041#issuecomment-719986800 https://api.github.com/repos/simonw/datasette/issues/1041 MDEyOklzc3VlQ29tbWVudDcxOTk4NjgwMA== simonw 9599 2020-10-31T20:49:28Z 2020-10-31T20:49:28Z OWNER

Implemented in a4ca26a2659d21779adf625183061d8879954c15

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
extra_js_urls and extra_css_urls should respect base_url setting 727627923  
719986698 https://github.com/simonw/datasette/issues/1072#issuecomment-719986698 https://api.github.com/repos/simonw/datasette/issues/1072 MDEyOklzc3VlQ29tbWVudDcxOTk4NjY5OA== simonw 9599 2020-10-31T20:48:17Z 2020-10-31T20:48:17Z OWNER

Here's the datasette-edit-templates plugin WIP I had before removing the hook: https://github.com/simonw/datasette-edit-templates/tree/82855c2612b84bc09c48fca885f831633a0d1552

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
load_template hook doesn't work for include/extends 733499930  
719983750 https://github.com/simonw/datasette/issues/1075#issuecomment-719983750 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4Mzc1MA== simonw 9599 2020-10-31T20:22:29Z 2020-10-31T20:22:29Z OWNER

I bet this is because I'm mucking around with one of those __ methods. I'll try just doing the non-underscore methods instead.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719983565 https://github.com/simonw/datasette/issues/1075#issuecomment-719983565 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4MzU2NQ== simonw 9599 2020-10-31T20:21:03Z 2020-10-31T20:21:03Z OWNER

Here's the output of dir(str):

['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719983484 https://github.com/simonw/datasette/issues/1075#issuecomment-719983484 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4MzQ4NA== simonw 9599 2020-10-31T20:20:28Z 2020-10-31T20:20:28Z OWNER

It looks like this is specific to the way PrefixedUrlString is built. (Pdb) class Weird(str): pass (Pdb) isinstance(Weird('bob'), collections.abc.Awaitable) False So subclassing strings doesn't trigger this bug, but something about PrefixedUrlString causes the problem.

Here's the current PrefixedUrlString implementation:

https://github.com/simonw/datasette/blob/bf18b9ba175a7b25fb8b765847397dd6efb8bb7b/datasette/utils/init.py#L1015-L1035

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719983240 https://github.com/simonw/datasette/issues/1075#issuecomment-719983240 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4MzI0MA== simonw 9599 2020-10-31T20:18:49Z 2020-10-31T20:18:49Z OWNER

Here's the core problem: (Pdb) isinstance('bob', collections.abc.Awaitable) False (Pdb) isinstance(PrefixedUrlString('bob'), collections.abc.Awaitable) *** TypeError: issubclass() arg 1 must be a class For some reason isinstance() does not like being handed an instance of PrefixedUrlString.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719981173 https://github.com/simonw/datasette/issues/1075#issuecomment-719981173 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4MTE3Mw== simonw 9599 2020-10-31T20:02:30Z 2020-10-31T20:03:45Z OWNER

I wonder how Jinja's Markup() class works? It uses https://pypi.org/project/MarkupSafe/

It's a subclass of str, defined here: https://github.com/pallets/markupsafe/blob/master/src/markupsafe/init.py

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719980742 https://github.com/simonw/datasette/issues/1075#issuecomment-719980742 https://api.github.com/repos/simonw/datasette/issues/1075 MDEyOklzc3VlQ29tbWVudDcxOTk4MDc0Mg== simonw 9599 2020-10-31T19:58:57Z 2020-10-31T19:58:57Z OWNER

Sample traceback: ``` <link rel="stylesheet" href="{{ urls.static('app.css') }}?{{ app_css_hash }}"> /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/jinja2/asyncsupport.py:173: in auto_await if inspect.isawaitable(value): /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/inspect.py:226: in isawaitable isinstance(object, collections.abc.Awaitable)) /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/abc.py:139: in instancecheck return _abc_instancecheck(cls, instance)


cls = <class 'collections.abc.Awaitable'> subclass = <bound method PrefixedUrlString.__getattribute__.\<locals>.method of '/-/static/app.css'>

def __subclasscheck__(cls, subclass):
    """Override for issubclass(subclass, cls)."""
  return _abc_subclasscheck(cls, subclass)

E TypeError: issubclass() arg 1 must be a class `` This is within Jinja. It looks like Jinja really doesn't like methods that return non-string objects likePrefixedUrlString`.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
PrefixedUrlString mechanism broke everything 733796942  
719977864 https://github.com/simonw/datasette/issues/1074#issuecomment-719977864 https://api.github.com/repos/simonw/datasette/issues/1074 MDEyOklzc3VlQ29tbWVudDcxOTk3Nzg2NA== simonw 9599 2020-10-31T19:35:01Z 2020-10-31T19:35:01Z OWNER

These plugins were not designed to be actually hosted online, so they do some nasty things like linking to the made-up plugin-example.com domain. I should fix that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
latest.datasette.io should include plugins from fixtures 733768037  
719966176 https://github.com/simonw/datasette/issues/1067#issuecomment-719966176 https://api.github.com/repos/simonw/datasette/issues/1067 MDEyOklzc3VlQ29tbWVudDcxOTk2NjE3Ng== simonw 9599 2020-10-31T17:51:31Z 2020-10-31T17:51:31Z OWNER

Demo:

  • https://latest.datasette.io/fixtures/facetable?_bot=1
  • https://latest.datasette.io/fixtures/simple_view?_bot=1
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table actions menu on view pages, not on query pages 732905360  
719965426 https://github.com/simonw/datasette/issues/1074#issuecomment-719965426 https://api.github.com/repos/simonw/datasette/issues/1074 MDEyOklzc3VlQ29tbWVudDcxOTk2NTQyNg== simonw 9599 2020-10-31T17:45:00Z 2020-10-31T17:45:00Z OWNER

This is working. Go to https://latest.datasette.io/login-as-root and click the button, then visit this page to see extra content added by plugins: https://latest.datasette.io/fixtures/compound_three_primary_keys

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
latest.datasette.io should include plugins from fixtures 733768037  
719963074 https://github.com/simonw/datasette/issues/1074#issuecomment-719963074 https://api.github.com/repos/simonw/datasette/issues/1074 MDEyOklzc3VlQ29tbWVudDcxOTk2MzA3NA== simonw 9599 2020-10-31T17:23:48Z 2020-10-31T17:23:48Z OWNER

Needs a way to login as root, seeing as several plugins only show extra content if the user is logged in as root.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
latest.datasette.io should include plugins from fixtures 733768037  
719961701 https://github.com/simonw/datasette/issues/1067#issuecomment-719961701 https://api.github.com/repos/simonw/datasette/issues/1067 MDEyOklzc3VlQ29tbWVudDcxOTk2MTcwMQ== simonw 9599 2020-10-31T17:11:59Z 2020-10-31T17:11:59Z OWNER

It bothers me that these aren't visible in any public demos. Maybe latest.datasette.io should include the my_plugins.py and my_plugins2.py plugins?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table actions menu on view pages, not on query pages 732905360  
719959754 https://github.com/simonw/datasette/issues/1026#issuecomment-719959754 https://api.github.com/repos/simonw/datasette/issues/1026 MDEyOklzc3VlQ29tbWVudDcxOTk1OTc1NA== simonw 9599 2020-10-31T16:56:35Z 2020-10-31T16:56:35Z OWNER

1041 can also benefit from the string subclass that shows that base_url has been added.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
How should datasette.client interact with base_url 722738988  
719959419 https://github.com/simonw/datasette/issues/1067#issuecomment-719959419 https://api.github.com/repos/simonw/datasette/issues/1067 MDEyOklzc3VlQ29tbWVudDcxOTk1OTQxOQ== simonw 9599 2020-10-31T16:53:42Z 2020-10-31T16:53:42Z OWNER

For the 0.51 release I'm going to add tests that show this works on view pages. I won't implement it for query pages.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table actions menu on view pages, not on query pages 732905360  
719956184 https://github.com/simonw/datasette/issues/1067#issuecomment-719956184 https://api.github.com/repos/simonw/datasette/issues/1067 MDEyOklzc3VlQ29tbWVudDcxOTk1NjE4NA== simonw 9599 2020-10-31T16:26:09Z 2020-10-31T16:26:09Z OWNER

Should the hook provide an indication that it's running on a different type of page? I think yes for queries. Not sure about views - they behave very much like tables, and the plugin can always introspect to see if something is a view if it needs to.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table actions menu on view pages, not on query pages 732905360  
719955724 https://github.com/simonw/datasette/issues/1070#issuecomment-719955724 https://api.github.com/repos/simonw/datasette/issues/1070 MDEyOklzc3VlQ29tbWVudDcxOTk1NTcyNA== simonw 9599 2020-10-31T16:22:45Z 2020-10-31T16:22:45Z OWNER

I've removed this plugin hook in #1073.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
load_template() example in documentation showing loading from a database 733390884  
719955491 https://github.com/simonw/datasette/issues/1072#issuecomment-719955491 https://api.github.com/repos/simonw/datasette/issues/1072 MDEyOklzc3VlQ29tbWVudDcxOTk1NTQ5MQ== simonw 9599 2020-10-31T16:20:58Z 2020-10-31T16:20:58Z OWNER

Here's the proof of concept FunctionLoader that showed me that this wasn't going to work: ```diff diff --git a/datasette/app.py b/datasette/app.py index 4b28e71..b076be7 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -21,7 +21,7 @@ from pathlib import Path from markupsafe import Markup from itsdangerous import URLSafeSerializer import jinja2 -from jinja2 import ChoiceLoader, Environment, FileSystemLoader, PrefixLoader +from jinja2 import ChoiceLoader, Environment, FileSystemLoader, FunctionLoader, PrefixLoader from jinja2.environment import Template from jinja2.exceptions import TemplateNotFound import uvicorn @@ -300,6 +300,7 @@ class Datasette: template_paths.append(default_templates) template_loader = ChoiceLoader( [ + FunctionLoader(self._load_template_from_plugins), FileSystemLoader(template_paths), # Support {% extends "default:table.html" %}: PrefixLoader( @@ -322,6 +323,17 @@ class Datasette: self._root_token = secrets.token_hex(32) self.client = DatasetteClient(self)

  • def _load_template_from_plugins(self, template):
  • "If auto reloading is enabled it’s called to check if the template changed"

  • uptodatefunc = lambda: True
  • source = pm.hook.load_template(
  • template=template,
  • datasette=self,
  • )
  • if source is None:
  • return None
  • return source, template, uptodatefunc + @property def urls(self): return Urls(self) @@ -719,35 +731,7 @@ class Datasette: else: if isinstance(templates, str): templates = [templates] -
  • Give plugins first chance at loading the template

  • break_outer = False
  • plugin_template_source = None
  • plugin_template_name = None
  • template_name = None
  • for template_name in templates:
  • if break_outer:
  • break
  • plugin_template_source = pm.hook.load_template(
  • template=template_name,
  • request=request,
  • datasette=self,
  • )
  • plugin_template_source = await await_me_maybe(plugin_template_source)
  • if plugin_template_source:
  • break_outer = True
  • plugin_template_name = template_name
  • break
  • if plugin_template_source is not None:
  • template = self.jinja_env.from_string(plugin_template_source)
  • else:
  • template = self.jinja_env.select_template(templates)
  • for template_name in templates:
  • from_plugin = template_name == plugin_template_name
  • used = from_plugin or template_name == template.name
  • templates_considered.append(
  • {"name": template_name, "used": used, "from_plugin": from_plugin}
  • )
  • template = self.jinja_env.select_template(templates) body_scripts = [] # pylint: disable=no-member for extra_script in pm.hook.extra_body_script( diff --git a/datasette/hookspecs.py b/datasette/hookspecs.py index ca84b35..7804def 100644 --- a/datasette/hookspecs.py +++ b/datasette/hookspecs.py @@ -50,7 +50,7 @@ def extra_template_vars(

@hookspec(firstresult=True) -def load_template(template, request, datasette): +def load_template(template, datasette): "Load the specified template, returning the template code as a string"

diff --git a/docs/plugin_hooks.rst b/docs/plugin_hooks.rst index 3c57b6a..8f2704e 100644 --- a/docs/plugin_hooks.rst +++ b/docs/plugin_hooks.rst @@ -273,15 +273,12 @@ Example: `datasette-cluster-map <https://github.com/simonw/datasette-cluster-map

.. _plugin_hook_load_template:

-load_template(template, request, datasette)

+load_template(template, datasette) +----------------------------------

template - string The template that is being rendered, e.g. database.html

-request - object or None - The current HTTP :ref:internals_request. This can be None if the request object is not available. - datasette - :ref:internals_datasette You can use this to access plugin configuration options via datasette.plugin_config(your_plugin_name) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
load_template hook doesn't work for include/extends 733499930  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1222.37ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows