Konstantin Baikov
8e18c79431
Use context manager instead of plain open ( #1211 )
...
Context manager with open closes the files after usage.
When the object is already a pathlib.Path i used read_text
write_text functions
In some cases pathlib.Path.open were used in context manager,
it is basically the same as builtin open.
Thanks, Konstantin Baikov!
2021-03-11 08:15:49 -08:00
Simon Willison
c38c42948c
extra_body_script module support, closes #1187
2021-01-13 18:14:33 -08:00
Simon Willison
fa0c3777b8
script type=module support, closes #1186
2021-01-13 17:50:52 -08:00
Miroslav Šedivý
a882d67962
Modernize code to Python 3.6+ ( #1158 )
...
* Compact dict and set building
* Remove redundant parentheses
* Simplify chained conditions
* Change method name to lowercase
* Use triple double quotes for docstrings
Thanks, @eumiro!
2020-12-23 09:04:32 -08:00
Simon Willison
dcdfb2c301
Rename _schemas to _internal, closes #1156
2020-12-21 11:48:06 -08:00
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