Commit graph

106 commits

Author SHA1 Message Date
Simon Willison
7239175f63 Fixed broken column header links, closes #1011 2020-10-09 20:51:56 -07:00
Simon Willison
8f97b9b58e
datasette.client internal requests mechanism
Closes #943

* Datasette now requires httpx>=0.15
* Support OPTIONS without 500, closes #1001
* Added internals tests for datasette.client methods
* Datasette's own test mechanism now uses httpx to simulate requests
* Tests simulate HTTP 1.1 now
* Added base_url in a bunch more places
* Mark some tests as xfail - will remove that when new httpx release ships: #1005
2020-10-09 09:11:24 -07:00
Simon Willison
a648bb82ba Upgrade to Black 20.8b1, closes #958 2020-09-02 15:24:55 -07:00
Simon Willison
799ecae948 register_output_renderer can now return Response, closes #953 2020-08-27 21:02:50 -07:00
Simon Willison
3a4c8ed36a Added columns argument to various extra_ plugin hooks, closes #938 2020-08-16 11:09:53 -07:00
Simon Willison
94ae840fe3 Plugin tests now start with test_hook_ 2020-08-16 10:49:33 -07:00
Simon Willison
e3639247cd Standard arguments for extra_ plugin hooks, closes #939 2020-08-16 09:50:23 -07:00
Simon Willison
549b1c2063 New forbidden() plugin hook, closes #812 2020-06-30 21:17:38 -07:00
Simon Willison
a8a5f81372 Made show_messages available to plugins, closes #864 2020-06-28 17:50:47 -07:00
Simon Willison
7ac4936cec .add_message() now works inside plugins, closes #864
Refs #870
2020-06-28 17:25:35 -07:00
Simon Willison
563f5a2d3a
Magic parameters for canned queries
Closes #842

Includes a new plugin hook, register_magic_parameters()
2020-06-27 19:58:16 -07:00
Simon Willison
4b142862f2 Support non-async view functions, closes #867 2020-06-27 11:30:34 -07:00
Simon Willison
1a5b7d318f Fixed test I broke in #863 2020-06-23 21:17:30 -07:00
Simon Willison
28bb1c5189 csrftoken() now works with .render_template(), closes #863 2020-06-23 20:23:50 -07:00
Simon Willison
6c26345836 New plugin hook: canned_queries(), refs #852 2020-06-18 16:35:15 -07:00
Simon Willison
6151c25a5a Respect existing scope["actor"] if set, closes #854 2020-06-18 11:37:28 -07:00
Simon Willison
d2aef9f7ef Test illustrating POST against register_routes(), closes #853 2020-06-18 09:21:15 -07:00
Simon Willison
72ae975156 Added test for async startup hook, refs #834 2020-06-13 10:58:32 -07:00
Simon Willison
09a3479a54 New "startup" plugin hook, closes #834 2020-06-13 10:55:41 -07:00
Simon Willison
fba8ff6e76 "$env": "X" mechanism now works with nested lists, closes #837 2020-06-11 17:21:48 -07:00
Simon Willison
f5e79adf26
register_routes() plugin hook (#819)
Fixes #215
2020-06-08 20:12:06 -07:00
Simon Willison
abc7339124 Nicer pattern for make_app_client() in tests, closes #395 2020-06-07 14:14:10 -07:00
Simon Willison
5278c04682 More consistent use of response.text/response.json in tests, closes #792 2020-06-02 14:29:12 -07:00
Simon Willison
1fc6ceefb9 Added /-/actor.json - refs #699
Also added JSON highlighting to introspection documentation.
2020-05-31 18:16:42 -07:00
Simon Willison
9315bacf6f Implemented datasette.permission_allowed(), refs #699 2020-05-31 18:16:42 -07:00
Simon Willison
461c82838d Implemented actor_from_request with tests, refs #699
Also added datasette argument to permission_allowed hook
2020-05-31 18:16:42 -07:00
Simon Willison
5ab411c733 can_render mechanism for register_output_renderer, closes #770 2020-05-27 22:57:05 -07:00
Simon Willison
510c1989d4 Removed xfail, refs #773 2020-05-27 21:11:53 -07:00
Simon Willison
6d95cb4f91 Unit test for register_facet_classes plugin, closes #773
I was a bit lazy with this one. I didn't hook up a test for the facet_results mechanism.
The custom facet hook isn't a great design so I will probably rethink it at some point
in the future anyway.
2020-05-27 21:09:16 -07:00
Simon Willison
defead17a4 Test for publish_subcommand hook, refs #773 2020-05-27 20:30:32 -07:00
Simon Willison
cbeea23d00 Test for prepare_jinja2_environment, refs #773 2020-05-27 20:13:32 -07:00
Simon Willison
57f48b8416 Made register_output_renderer callback optionally awaitable, closes #776 2020-05-27 19:43:30 -07:00
Simon Willison
52c4387c7d Redesigned register_output_renderer plugin hook, closes #581 2020-05-27 19:21:41 -07:00
Simon Willison
da87e963bf
Test that plugin hooks are unit tested (xfail)
This currently fails using xfail. Closes 771.
2020-05-27 13:16:02 -07:00
Simon Willison
450d2e2896 Fixed pytest warning about TestClient class 2020-05-04 10:42:10 -07:00
Simon Willison
09253817de Fix for missing view_name bug, closes #716 2020-04-05 11:28:20 -07:00
Simon Willison
7656fd64d8
base_url configuration setting, closes #394
* base_url configuration setting
* base_url works for static assets as well
2020-03-24 17:18:43 -07:00
Simon Willison
e1b5339fdf Do not look for templates_path in default plugins
Closes #697
2020-03-08 16:11:18 -07:00
Simon Willison
7c6a9c3529 Better tests for prepare_connection() plugin hook, refs #678 2020-02-21 18:27:07 -08:00
Simon Willison
8c642f04e0
Render templates using Jinja async mode
Closes #628
2019-11-14 15:14:22 -08:00
Simon Willison
fcfcae21e6
extra_template_vars plugin hook (#542)
* extra_template_vars plugin hook

Closes #541

* Workaround for cwd bug

Based on https://github.com/pytest-dev/pytest/issues/1235#issuecomment-175295691
2019-07-05 17:05:56 -07:00
Simon Willison
25ff0a8ba6 Fix for accidentally leaking secrets in /-/metadata, closes #538 2019-07-03 22:47:45 -07:00
Simon Willison
a2d4593193
Secret plugin configuration options (#539)
Closes #538
2019-07-03 22:36:44 -07:00
Simon Willison
4d2fdafe39 Added asgi_wrapper plugin hook, closes #520 2019-07-02 21:06:25 -07:00
Simon Willison
35d6ee2790
Apply black to everything, enforce via unit tests (#449)
I've run the black code formatting tool against everything:

    black tests datasette setup.py

I also added a new unit test, in tests/test_black.py, which will fail if the code does not
conform to black's exacting standards.

This unit test only runs on Python 3.6 or higher, because black itself doesn't run on 3.5.
2019-05-03 22:15:14 -04:00
Simon Willison
b7257a21bf
Fix json.loads in Python 3.5
3.5 requires a str, not a bytes

https://travis-ci.org/simonw/datasette/jobs/421660555
2018-08-28 17:55:30 +01:00
Simon Willison
b7c6a9f9bd
extra_css_urls(template, database, table, datasette)
The extra_css_urls and extra_js_urls hooks now take additional optional
parameters.

Also refactored them out of the Datasette class and into RenderMixin.

Plus improved plugin documentation to explicitly list parameters.
2018-08-28 11:56:57 +01:00
Simon Willison
2e836f72d9
render_cell(value, column, table, database, datasette)
The render_cell plugin hook previously was only passed value.

It is now passed (value, column, table, database, datasette).
2018-08-28 03:03:01 -07:00
Simon Willison
5cf0c6c91c
New plugin hook: extra_body_script 2018-08-28 02:02:49 -07:00
Simon Willison
0a14a4846b
Added plugin_config() method 2018-08-28 01:35:21 -07:00