Simon Willison
9c43b4164d
Removed @pytest.mark.ds_client mark - refs #1959
...
I don't need it - can run 'pytest -k ds_client' instead.
See https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828
2022-12-17 13:47:55 -08:00
Simon Willison
0e42444866
invoke_startup() inside ds_client fixture, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
e70974a4f1
Ran Black, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
42a66c2f04
A bunch of remaining ds_client conversions, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
be95359a80
ds_client for test_permissions.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
ef74d0ff70
ds_client for test_internal_db.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
4a151b15cc
ds_client for test_filters.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
30f1a0705b
ds_client for test_plugins.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
b998c2793f
test_facets.py using ds_client, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
bc88491cb7
ds_client for test_table_api.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
1335bcb893
Use my own global variable instead of scope=session
...
Refs https://github.com/simonw/datasette/pull/1960#issuecomment-1354148139
2022-12-17 13:47:55 -08:00
Simon Willison
ebd3358e49
ds_client for test_table_html.py
2022-12-17 13:47:55 -08:00
Simon Willison
d94d363ec0
Don't use pytest_asyncio.fixture(scope="session") any more, refs #1959
...
Also got rid of the weird memory=False hack:
https://github.com/simonw/datasette/pull/1960#issuecomment-1354053151
2022-12-17 13:47:55 -08:00
Simon Willison
95900b9d02
Port app_client to ds_client for most of test_html.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
3001eec66a
ds_client for test_csv.py and test_canned_queries.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
425ac4357f
Ported app_client to ds_client where possible in test_auth.py, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
b077e63dc6
Ported test_api.py app_client test to ds_client, refs #1959
2022-12-17 13:47:55 -08:00
Simon Willison
0b68996cc5
Revert "Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955"
...
This reverts commit dc18f62089
.
2022-12-15 13:06:45 -08:00
Simon Willison
dc18f62089
Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955
2022-12-15 09:34:07 -08:00
Simon Willison
c094dde3ff
Extra permission rules for /-/create, closes #1937
2022-12-14 12:21:18 -08:00
Simon Willison
e238df3959
Handle non-initials in permission_allowed_actor_restrictions, closes #1956
2022-12-14 12:04:23 -08:00
Simon Willison
1a3dcf4943
Don't include _memory on /-/create-token, refs #1947
2022-12-13 21:19:31 -08:00
Simon Willison
420d0a0ee2
Tests for /-/create-token with restrictions, closes #1947
2022-12-13 21:13:20 -08:00
Simon Willison
d98a8effb1
UI for restricting permissions on /-/create-token, refs #1947
...
Also fixes test failures I introduced in #1951
2022-12-13 21:03:17 -08:00
Simon Willison
f84acae98e
Return 400 errors for ?_sort errors, closes #1950
2022-12-13 14:23:17 -08:00
Simon Willison
45979eb723
Rename permission created by demo plugin
...
It was showing up as 'new-permission' on https://latest.datasette.io/-/permissions
which I thought was confusing
2022-12-12 21:21:01 -08:00
Simon Willison
a1a372f179
/-/actor no longer requires view-instance, refs #1945
2022-12-12 21:06:30 -08:00
Simon Willison
260fbb598e
Fix some failing tests, refs #1855
2022-12-12 21:00:40 -08:00
Simon Willison
809fad2392
Tests for datasette create-token restrictions, refs #1855
2022-12-12 20:44:19 -08:00
Simon Willison
c13dada2f8
datasette --get --token option, closes #1946 , refs #1855
2022-12-12 20:36:42 -08:00
Simon Willison
c6a811237c
/-/actor.json no longer requires view-instance, closes #1945
2022-12-12 20:11:51 -08:00
Simon Willison
3e6a208ba3
Rename 't' to 'r' in '_r' actor format, refs #1855
2022-12-12 19:27:34 -08:00
Simon Willison
c5d30b58a1
Implemented metadata permissions: property, closes #1636
2022-12-12 18:40:45 -08:00
Simon Willison
8bf06a76b5
register_permissions() plugin hook ( #1940 )
...
* Docs for permissions: in metadata, refs #1636
* Refactor default_permissions.py to help with implementation of #1636
* register_permissions() plugin hook, closes #1939 - also refs #1938
* Tests for register_permissions() hook, refs #1939
* Documentation for datasette.permissions, refs #1939
* permission_allowed() falls back on Permission.default, refs #1939
* Raise StartupError on duplicate permissions
* Allow dupe permisisons if exact matches
2022-12-12 18:05:54 -08:00
Simon Willison
34cffff02a
Refactor _headers() for write API tests
2022-12-07 17:39:07 -08:00
Simon Willison
dee18ed8ce
test_create_table_error_rows_twice_with_duplicates, refs #1927
2022-12-07 17:29:24 -08:00
Simon Willison
9342b60f14
test_create_table_error_if_pk_changed, refs #1927
2022-12-07 17:27:01 -08:00
Simon Willison
6b27537988
ignore/replace to create requires pk, refs #1927
2022-12-07 17:18:40 -08:00
Simon Willison
272982e8a6
/db/table/-/upsert API
...
Close #1878
Also made a few tweaks to how _r works in tokens and actors,
refs #1855 - I needed that mechanism for the tests.
2022-12-07 17:12:15 -08:00
Simon Willison
93ababe6f7
Initial attempt at insert/replace for /-/create, refs #1927
2022-12-02 23:00:18 -08:00
Simon Willison
d7e5e3c9f9
Fix for todomvc permission check
...
Refs https://github.com/simonw/todomvc-datasette/issues/2
2022-12-01 17:38:23 -08:00
Simon Willison
27efa8c381
todomvc permissions and fixed DATASETTE_SECRET for new demo
...
Refs https://github.com/simonw/todomvc-datasette/issues/2
2022-12-01 17:29:44 -08:00
Simon Willison
f3c8da7acd
MAke the sign in as root button bigger on latest.datasette.io
2022-12-01 13:29:31 -08:00
Simon Willison
7fde34cfcb
Documentation and test for UNIQUE constraint failed, refs #1924
2022-11-30 18:05:29 -08:00
Simon Willison
31d6a0bc5e
Applied Black, refs #1922
2022-11-30 15:17:39 -08:00
Simon Willison
f0fadc28dd
Access-Control-Allow-Headers: Authorization, Content-Type - refs #1922
2022-11-30 15:11:18 -08:00
Simon Willison
2cd7ecaa0a
Apply Black, refs #1922
2022-11-30 13:54:47 -08:00
Simon Willison
6bfd71f5c6
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS - refs #1922
2022-11-30 12:25:12 -08:00
Simon Willison
4c18730e71
Update tests to export 200 for OPTIONS calls, refs #1922
2022-11-30 10:29:48 -08:00
Simon Willison
48725bb4ea
CORS headers for write APIs, refs #1922
2022-11-30 09:27:10 -08:00
Simon Willison
8404b21556
405 method not allowed for GET to POST endpoints, closes #1916
2022-11-29 21:15:13 -08:00
Simon Willison
6b47734c04
_memory database should not be mutable, closes #1917
2022-11-29 21:06:52 -08:00
Simon Willison
b8fc8e2cd7
Merge branch 'main' into 1.0-dev
2022-11-29 11:34:39 -08:00
Simon Willison
6bda225786
Tests for rowid and compound pk row deletion, closes #1864
2022-11-29 10:53:55 -08:00
Simon Willison
1154048f79
Compound primary key support for /db/-/create - closes #1911
...
Needed for tests in #1864
2022-11-29 10:47:48 -08:00
Simon Willison
484bef0d3b
/db/table/pk/-/update endpoint, closes #1863
2022-11-29 10:06:19 -08:00
Simon Willison
733447d7c7
Upgrade to Python 3.11 on Heroku, refs #1905
2022-11-18 16:44:46 -08:00
Simon Willison
72ac9bf82f
--generate-dir option to publish heroku, refs #1905
2022-11-18 16:34:33 -08:00
Simon Willison
c588a89f26
db.view_exists() method, needed by #1896
2022-11-18 14:16:38 -08:00
Simon Willison
b29ccb59c7
Add test for db.view_names()
2022-11-18 14:13:48 -08:00
Simon Willison
83a6872d1b
Include views in SQL autocomplete, refs #1897
2022-11-17 18:53:48 -08:00
Simon Willison
98611b3da0
Include SQL schema for CodeMirror on query pages, closes #1897
...
Refs #1893
2022-11-17 17:24:44 -08:00
Simon Willison
b35522c6dd
Updated test, refs #1890
2022-11-17 17:23:35 -08:00
Simon Willison
3e61a41b9b
Include SQL schema for CodeMirror on query pages, closes #1897
...
Refs #1893
2022-11-17 17:19:37 -08:00
Simon Willison
6f610e1d94
Updated test, refs #1890
2022-11-15 19:04:24 -08:00
Simon Willison
187d91d686
/db/-/create API endpoint, closes #1882
2022-11-14 21:57:28 -08:00
Simon Willison
264d0ab471
Renamed return_rows to return in insert API
...
Refs https://github.com/simonw/datasette/issues/1866#issuecomment-1313128913
2022-11-13 21:49:23 -08:00
Simon Willison
65521f03db
Error for drop against immutable database, closes #1874
2022-11-13 21:40:10 -08:00
Simon Willison
612da8eae6
confirm: true mechanism for drop table API, closes #1887
2022-11-13 21:17:18 -08:00
Simon Willison
fa9cc9efaf
Fix for redirects ignoring base_url, refs #1883
2022-11-12 12:29:59 -08:00
Simon Willison
26262d08f3
Test form actions use prefix, refs #1883
2022-11-12 12:29:59 -08:00
Simon Willison
8d9a957c63
Fix for redirects ignoring base_url, refs #1883
2022-11-10 22:49:54 -08:00
Simon Willison
bbaab3b38e
Test form actions use prefix, refs #1883
2022-11-10 22:20:40 -08:00
Simon Willison
bcc781f4c5
Implementation and tests for _r field on actor, refs #1855
...
New mechanism for restricting permissions further for a given actor.
This still needs documentation. It will eventually be used by the mechanism to issue
signed API tokens that are only able to perform a subset of actions.
This also adds tests that exercise the POST /-/permissions tool, refs #1881
2022-11-03 17:12:23 -07:00
Simon Willison
867e0abd34
Tests now close SQLite database connections and files explicitly, refs #1843
...
Also added a db.close() method to the Database class.
2022-11-03 13:37:26 -07:00
Simon Willison
2355067ef5
Tests now close SQLite database connections and files explicitly, refs #1843
...
Also added a db.close() method to the Database class.
2022-11-03 13:36:11 -07:00
Simon Willison
497290beaf
Handle database errors in /-/insert, refs #1866 , #1873
...
Also improved API explorer to show HTTP status of response, refs #1871
2022-11-01 12:59:17 -07:00
Simon Willison
9bec7c38eb
ignore and replace options for bulk inserts, refs #1873
...
Also removed the rule that you cannot include primary keys in the rows you insert.
And added validation that catches invalid parameters in the incoming JSON.
And renamed "inserted" to "rows" in the returned JSON for return_rows: true
2022-11-01 11:08:17 -07:00
Simon Willison
93a02281da
Show interrupted query in resizing textarea, closes #1876
2022-11-01 10:38:24 -07:00
Simon Willison
2ec5583629
Show interrupted query in resizing textarea, closes #1876
2022-11-01 10:22:26 -07:00
Simon Willison
00632ded30
Initial attempt at /db/table/row/-/delete, refs #1864
2022-10-30 16:16:00 -07:00
Simon Willison
2865d3956f
/db/table/-/drop API, closes #1874
2022-10-30 15:17:21 -07:00
Simon Willison
f6bf2d8045
Initial prototype of API explorer at /-/api, refs #1871
2022-10-29 23:20:11 -07:00
Simon Willison
c35859ae3d
API for bulk inserts, closes #1866
2022-10-29 23:03:45 -07:00
Simon Willison
6e788b49ed
New URL design /db/table/-/insert, refs #1851
2022-10-27 13:18:05 -07:00
Simon Willison
a2a5dff709
Missing tests for insert row API, refs #1851
2022-10-27 12:08:26 -07:00
Simon Willison
6958e21b5c
Add test for /* multi line */ comment, refs #1860
2022-10-27 11:52:06 -07:00
Simon Willison
b597bb6b3e
Better comment handling in SQL regex, refs #1860
2022-10-27 11:52:06 -07:00
Simon Willison
d2ca13b699
Add test for /* multi line */ comment, refs #1860
2022-10-27 11:50:54 -07:00
Simon Willison
5f6be3c48b
Better comment handling in SQL regex, refs #1860
2022-10-27 11:47:48 -07:00
Simon Willison
382a871583
max_signed_tokens_ttl setting, closes #1858
...
Also redesigned token format to include creation time and optional duration.
2022-10-26 20:14:59 -07:00
Simon Willison
af5d5d0243
Allow leading comments on SQL queries, refs #1860
2022-10-26 20:14:59 -07:00
Simon Willison
55f860c304
Fix bug with breadcrumbs and request=None, closes #1849
2022-10-26 20:14:59 -07:00
Simon Willison
55a709c480
Allow leading comments on SQL queries, refs #1860
2022-10-26 14:34:33 -07:00
Simon Willison
df7bf0b2fc
Fix bug with breadcrumbs and request=None, closes #1849
2022-10-26 14:13:31 -07:00
Simon Willison
c7956eed77
datasette create-token command, refs #1859
2022-10-25 21:26:12 -07:00
Simon Willison
c556fad65d
Try to address too many files error again, refs #1843
2022-10-25 21:25:47 -07:00
Simon Willison
c36a74ece1
Try shutting down executor in tests to free up thread local SQLite connections, refs #1843
2022-10-25 21:04:39 -07:00
Simon Willison
c23fa850e7
allow_signed_tokens setting, closes #1856
2022-10-25 19:55:47 -07:00
Simon Willison
0f013ff497
Mechanism to prevent tokens creating tokens, closes #1857
2022-10-25 19:43:55 -07:00
Simon Willison
b29e487bc3
actor_from_request for dstok_ tokens, refs #1852
2022-10-25 19:18:41 -07:00
Simon Willison
7ab091e8ef
Tests and docs for /-/create-token, refs #1852
2022-10-25 19:04:05 -07:00
Simon Willison
f9ae92b377
Poll until servers start, refs #1854
2022-10-25 16:03:36 -07:00
Simon Willison
c7dd76c262
Poll until servers start, refs #1854
2022-10-25 12:42:45 -07:00
Simon Willison
9676b2deb0
Upgrade Docker images to Python 3.11, closes #1853
2022-10-25 12:04:53 -07:00
Simon Willison
02ae1a0029
Upgrade Docker images to Python 3.11, closes #1853
2022-10-25 12:04:25 -07:00
Simon Willison
5be86d48b2
Fix display of padlocks on database page, closes #1848
2022-10-23 19:42:30 -07:00
Simon Willison
78dad236df
check_visibility can now take multiple permissions into account
...
Closes #1829
2022-10-23 19:11:33 -07:00
Simon Willison
6887c12ea3
Workaround for 'too many open files' error, refs #1843
2022-10-23 15:17:33 -07:00
Simon Willison
79aa0de083
Test that breadcrumbs respect permissions, closes #1831
2022-10-13 14:51:59 -07:00
Simon Willison
1a5e5f2aa9
Refactor breadcrumbs to respect permissions, refs #1831
2022-10-13 14:42:52 -07:00
Simon Willison
b7fec7f902
.sqlite/.sqlite3 extensions for config directory mode
...
Closes #1646
2022-10-07 16:03:30 -07:00
Simon Willison
bbf33a7635
Test for bool(results), closes #1832
2022-10-04 21:32:29 -07:00
Simon Willison
5f9f567acb
Show SQL query when reporting time limit error, closes #1819
2022-09-26 16:06:01 -07:00
Simon Willison
cb1e093fd3
Fixed error message, closes #1816
2022-09-19 18:15:40 -07:00
Simon Willison
df851c117d
Validate settings.json keys on startup, closes #1816
...
Refs #1814
2022-09-19 16:46:39 -07:00
Simon Willison
ddc999ad12
Async support for prepare_jinja2_environment, closes #1809
2022-09-16 20:38:24 -07:00
Simon Willison
b40872f5e5
prepare_jinja2_environment(datasette) argument, refs #1809
2022-09-14 14:31:54 -07:00
Simon Willison
fb7e70d5e7
Database(is_mutable=) now defaults to True, closes #1808
...
Refs https://github.com/simonw/datasette-upload-dbs/issues/6
2022-09-09 09:19:20 -07:00
Simon Willison
5aa359b869
Apply cell truncation on query page too, refs #1805
2022-09-06 16:58:30 -07:00
Simon Willison
d0737e4de5
truncate_cells_html now affects URLs too, refs #1805
2022-09-06 16:50:43 -07:00
Simon Willison
8430c3bc7d
table facet_size in metadata, refs #1804
2022-09-06 08:59:19 -07:00
Simon Willison
64288d827f
Workaround for test failure: RuntimeError: There is no current event loop ( #1803 )
...
* Remove ensure_eventloop hack
* Hack to recover from intermittent RuntimeError calling asyncio.Lock()
2022-09-05 17:40:19 -07:00
Simon Willison
b2b901e8c4
Skip SpatiaLite test if no conn.enable_load_extension()
...
Ran into this problem while working on #1802
2022-09-05 17:09:57 -07:00
Simon Willison
ba35105eee
Test `--load-extension` in GitHub Actions ( #1792 )
...
* Run the --load-extension test, refs #1789
* Ran cog, refs #1789
2022-08-23 17:11:45 -07:00
Alex Garcia
1d64c9a8da
Add new entrypoint option to --load-extensions. ( #1789 )
...
Thanks, @asg017
2022-08-23 11:34:30 -07:00
Simon Willison
a3e6f1b167
Increase height of non-JS textarea to fit query
...
Closes #1786
2022-08-18 09:06:02 -07:00
Simon Willison
82167105ee
--min-instances and --max-instances Cloud Run publish options, closes #1779
2022-08-14 10:07:30 -07:00
Simon Willison
c1396bf860
Don't allow canned write queries on immutable DBs, closes #1728
2022-08-14 09:34:31 -07:00
Simon Willison
1563c22a8c
Don't duplicate _sort_desc, refs #1738
2022-08-14 09:13:12 -07:00
Simon Willison
080d4b3e06
Switch to python:3.10.6-slim-bullseye for datasette publish - refs #1768
2022-08-14 08:49:14 -07:00
Simon Willison
df4fd2d7dd
_sort= works even if sort column not selected, closes #1773
2022-08-14 08:44:02 -07:00
Chris Amico
01369176b0
Keep track of datasette.config_dir ( #1766 )
...
Thanks, @eyeseast - closes #1764
2022-07-17 18:12:45 -07:00
Simon Willison
c09c53f345
New handle_exception plugin hook, refs #1770
...
Also refs:
- https://github.com/simonw/datasette-sentry/issues/1
- https://github.com/simonw/datasette-show-errors/issues/2
2022-07-17 16:24:39 -07:00
Simon Willison
6373bb3414
Expose current SQLite row to render_cell hook, closes #1300
2022-07-07 09:30:49 -07:00
Simon Willison
7d1e004ff6
Fix test I broke in #1744
2022-05-17 13:09:07 -07:00
Simon Willison
280ff372ab
ETag support for .db downloads, closes #1739
2022-05-03 07:59:46 -07:00
Simon Willison
3f00a29141
Clean up compatibility with Pyodide ( #1736 )
...
* Optional uvicorn import for Pyodide, refs #1733
* --setting num_sql_threads 0 to disable threading, refs #1735
2022-05-02 13:15:27 -07:00
Simon Willison
687907aa2b
Remove python-baseconv dependency, refs #1733 , closes #1734
2022-05-02 12:39:06 -07:00
Tim Sherratt
3001e1e394
Add timeout option to Cloudrun build ( #1717 )
...
* Add timeout option for build phase
* Make the --timeout setting optional
* Add test for --timeout setting
Thanks, @wragge
2022-04-24 07:03:08 -07:00
Simon Willison
0bc5186b7b
Tooltip and commas for byte length display, closes #1712
2022-04-12 11:44:12 -07:00
Simon Willison
90d1be9952
Tilde encoding now encodes space as plus, closes #1701
...
Refs #1657
2022-04-06 08:55:01 -07:00
Simon Willison
5c5e9b3657
Request.fake(... url_vars), plus .fake() is now documented
...
Also made 'from datasette import Request' shortcut work.
Closes #1697
2022-03-31 19:01:58 -07:00
Simon Willison
c496f2b663
Don't show facet in cog menu if not allow_facet, closes #1683
2022-03-24 12:16:19 -07:00
Simon Willison
0159662ab8
Fix for bug running ?sql= against databases with a different route, closes #1682
2022-03-23 11:48:10 -07:00
Simon Willison
194e4f6c3f
Removed check_permission() from BaseView, closes #1677
...
Refs #1660
2022-03-21 11:41:56 -07:00
Simon Willison
cdbae2b93f
Fixed internal links to respect db.route, refs #1668
2022-03-19 17:31:23 -07:00
Simon Willison
7a6654a253
Databases can now have a .route separate from their .name, refs #1668
2022-03-19 17:11:17 -07:00
Simon Willison
798f075ef9
Read format from route captures, closes #1667
...
Refs #1660
2022-03-19 13:32:29 -07:00
Simon Willison
b9c2b1cfc8
Consistent treatment of format in route capturing, refs #1667
...
Also refs #1660
2022-03-19 13:29:10 -07:00