{"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719983750", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719983750, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4Mzc1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T20:22:29Z", "updated_at": "2020-10-31T20:22:29Z", "author_association": "OWNER", "body": "I bet this is because I'm mucking around with one of those `__` methods. I'll try just doing the non-underscore methods instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719983565", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719983565, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4MzU2NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T20:21:03Z", "updated_at": "2020-10-31T20:21:03Z", "author_association": "OWNER", "body": "Here's the output of `dir(str)`:\r\n\r\n`['__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']`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719983484", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719983484, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4MzQ4NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T20:20:28Z", "updated_at": "2020-10-31T20:20:28Z", "author_association": "OWNER", "body": "It looks like this is specific to the way `PrefixedUrlString` is built.\r\n```\r\n(Pdb) class Weird(str): pass\r\n(Pdb) isinstance(Weird('bob'), collections.abc.Awaitable)\r\nFalse\r\n```\r\nSo subclassing strings doesn't trigger this bug, but something about `PrefixedUrlString` causes the problem.\r\n\r\nHere's the current `PrefixedUrlString` implementation:\r\n\r\nhttps://github.com/simonw/datasette/blob/bf18b9ba175a7b25fb8b765847397dd6efb8bb7b/datasette/utils/__init__.py#L1015-L1035", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719983240", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719983240, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4MzI0MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T20:18:49Z", "updated_at": "2020-10-31T20:18:49Z", "author_association": "OWNER", "body": "Here's the core problem:\r\n```\r\n(Pdb) isinstance('bob', collections.abc.Awaitable)\r\nFalse\r\n(Pdb) isinstance(PrefixedUrlString('bob'), collections.abc.Awaitable)\r\n*** TypeError: issubclass() arg 1 must be a class\r\n```\r\nFor some reason `isinstance()` does not like being handed an instance of PrefixedUrlString.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719981173", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719981173, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4MTE3Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T20:02:30Z", "updated_at": "2020-10-31T20:03:45Z", "author_association": "OWNER", "body": "I wonder how Jinja's `Markup()` class works? It uses https://pypi.org/project/MarkupSafe/\r\n\r\nIt's a subclass of `str`, defined here: https://github.com/pallets/markupsafe/blob/master/src/markupsafe/__init__.py", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1075#issuecomment-719980742", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1075", "id": 719980742, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTk4MDc0Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-31T19:58:57Z", "updated_at": "2020-10-31T19:58:57Z", "author_association": "OWNER", "body": "Sample traceback:\r\n```\r\n \r\n/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/jinja2/asyncsupport.py:173: in auto_await\r\n if inspect.isawaitable(value):\r\n/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/inspect.py:226: in isawaitable\r\n isinstance(object, collections.abc.Awaitable))\r\n/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/abc.py:139: in __instancecheck__\r\n return _abc_instancecheck(cls, instance)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\ncls = \r\nsubclass = .method of '/-/static/app.css'>\r\n\r\n def __subclasscheck__(cls, subclass):\r\n \"\"\"Override for issubclass(subclass, cls).\"\"\"\r\n> return _abc_subclasscheck(cls, subclass)\r\nE TypeError: issubclass() arg 1 must be a class\r\n```\r\nThis is within Jinja. It looks like Jinja really doesn't like methods that return non-string objects like `PrefixedUrlString`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 733796942, "label": "PrefixedUrlString mechanism broke everything"}, "performed_via_github_app": null}