Simon Willison
ebc7aa287c
In-memory _schemas database tracking schemas of attached tables, closes #1150
2020-12-18 14:34:05 -08:00
Simon Willison
13c960c03b
Test is no longer order dependent, closes #1123
2020-12-02 16:49:55 -08:00
Simon Willison
17cbbb1f7f
generated_columns table in fixtures.py, closes #1119
2020-11-30 16:28:02 -08:00
Simon Willison
461670a0b8
Support for generated columns
...
* Support for generated columns, closes #1116
* Show SQLite version in pytest report header
* Use table_info() if SQLite < 3.26.0
* Cache sqlite_version() rather than re-calculate every time
* Adjust test_database_page for SQLite 3.26.0 or higher
2020-11-30 13:29:57 -08:00
Simon Willison
30e64c8d3b
Use f-strings in place of .format()
...
Code transformed like so:
pip install flynt
flynt .
black .
2020-11-15 15:24:22 -08:00
Simon Willison
7b19492070
database_actions() plugin hook, closes #1077
2020-11-02 10:27:25 -08:00
Simon Willison
bf18b9ba17
Stop using plugin-example.com, closes #1074
2020-10-31 12:47:42 -07:00
Simon Willison
b84cfe1b08
Confirm table actions work on views, closes #1067
2020-10-31 10:40:09 -07:00
Simon Willison
f0a740ac21
Remove load_plugin hook - closes #1073
...
Refs #1042
This reverts commit 81dea4b07a
.
2020-10-31 09:21:22 -07:00
Simon Willison
81dea4b07a
load_template() plugin hook
...
Closes #1042
2020-10-30 10:47:18 -07:00
Simon Willison
2f7731e9e5
table_actions() plugin hook plus menu, closes #1066
...
Refs #690
2020-10-29 22:16:41 -07:00
Simon Willison
18a64fbb29
Navigation menu plus menu_links() hook
...
Closes #1064 , refs #690 .
2020-10-29 20:45:15 -07:00
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
Simon Willison
4ac9132240
render_cell(value) plugin hook, closes #352
...
New plugin hook for customizing the way cells values are rendered in HTML.
The first full example of this hook in use is https://github.com/simonw/datasette-json-html
2018-08-04 17:14:56 -07:00
Simon Willison
0357774c94
Renamed test_tables.db to fixtures.db in unit tests
2018-06-17 11:34:16 -07:00
Simon Willison
864328e074
Test client wrapper removing need for gather_request - refs #272
...
As part of decoupling from Sanic, this will make it easier to run tests
against ASGI instead.
2018-06-04 20:53:12 -07:00
Simon Willison
969771770f
Upgrade pytest to 3.6.0
...
https://github.com/pytest-dev/pytest/issues/1875 made it impossible to declare
a function as a fixture multiple times, which we were doing across different
modules. The fix was to move our @pytest.fixture calls into decorators in the
tests/fixtures.py module.
2018-05-31 06:42:37 -07:00
Simon Willison
98c8f0e728
Moved plugin HTML tests from test_html to test_plugins
2018-05-28 14:23:48 -07:00
Simon Willison
fefb0db8ae
Unit test for 02870e57
, closes #291
2018-05-28 13:41:53 -07:00