Simon Willison
db660db463
Docs + unit tests for Response, closes #821
2020-06-08 20:32:10 -07:00
Simon Willison
f5e79adf26
register_routes() plugin hook ( #819 )
...
Fixes #215
2020-06-08 20:12:06 -07:00
Simon Willison
647c5ff0f3
Fixed broken CSS on 404 page, closes #777
2020-06-08 17:35:23 -07:00
Simon Willison
49d6d2f7b0
allow_sql block to control execute-sql upermission in metadata.json, closes #813
...
Also removed the --config allow_sql:0 mechanism in favour of the new allow_sql block.
2020-06-08 17:05:44 -07:00
Simon Willison
040fc0546f
Updated tests, refs #817
2020-06-08 12:02:56 -07:00
Simon Willison
799c5d5357
Renamed resource_identifier to resource, refs #817
2020-06-08 11:59:53 -07:00
Simon Willison
c9f1ec616e
Removed resource_type from permissions system, closes #817
...
Refs #811 , #699
2020-06-08 11:51:03 -07:00
Simon Willison
5598c5de01
Database list on index page respects table/view permissions, refs #811
2020-06-08 11:34:14 -07:00
Simon Willison
dcec89270a
View list respects view-table permission, refs #811
...
Also makes a small change to the /fixtures.json JSON:
"views": ["view_name"]
Is now:
"views": [{"name": "view_name", "private": true}]
2020-06-08 11:20:59 -07:00
Simon Willison
9ac27f67fe
Show padlock on private query page, refs #811
2020-06-08 11:13:32 -07:00
Simon Willison
aa420009c0
Show padlock on private table page, refs #811
2020-06-08 11:07:11 -07:00
Simon Willison
2a8b39800f
Updated tests, refs #811
2020-06-08 07:50:06 -07:00
Simon Willison
3ce7f2e7da
Show padlock on private database page, refs #811
2020-06-08 07:23:10 -07:00
Simon Willison
1cf86e5ecc
Show padlock on private index page, refs #811
2020-06-08 07:18:47 -07:00
Simon Willison
cc218fa9be
Move assert_permissions_checked() calls from test_html.py to test_permissions.py, refs #811
2020-06-08 07:02:31 -07:00
Simon Willison
9397d71834
Implemented view-table, refs #811
2020-06-07 21:47:22 -07:00
Simon Willison
b26292a458
Test that view-query is respected by query list, refs #811
2020-06-07 20:56:49 -07:00
Simon Willison
9b42e1a4f5
view-database permission
...
Also now using 🔒 to indicate private resources - resources that
would not be available to the anonymous user. Refs #811
2020-06-07 20:50:37 -07:00
Simon Willison
613fa551a1
Removed view-row permission, for the moment - refs #811
...
https://github.com/simonw/datasette/issues/811#issuecomment-640338347
2020-06-07 20:14:27 -07:00
Simon Willison
cd92e4fe2a
Fixed test name, this executes view-query, not execute-sql - refs #811
2020-06-07 14:33:56 -07:00
Simon Willison
8571ce388a
Implemented view-instance permission, refs #811
2020-06-07 14:30:39 -07:00
Simon Willison
ece0ba6f4b
Test + default impl for view-query permission, refs #811
2020-06-07 14:23:16 -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
a1e801453a
Renamed execute-query permission to execute-sql, refs #811
2020-06-07 13:20:59 -07:00
Simon Willison
4340845754
Nested permission checks for all views, refs #811
2020-06-07 13:03:08 -07:00
Simon Willison
86dec9e8ff
Added permission check to every view, closes #808
2020-06-06 22:30:36 -07:00
Simon Willison
3359d54a4e
Use cookies when accessing csrftoken_from
2020-06-06 12:33:08 -07:00
Simon Willison
966eec7f75
Check permissions on canned query page, refs #800
2020-06-06 12:27:00 -07:00
Simon Willison
070838bfa1
Better test for Vary header
2020-06-06 12:26:19 -07:00
Simon Willison
3f83d4632a
Respect query permissions on database page, refs #800
2020-06-06 12:05:22 -07:00
Simon Willison
14f6b4d200
actor_matches_allow utility function, refs #800
2020-06-06 11:39:11 -07:00
Simon Willison
75c143a84c
Fixed /-/plugins?all=1, refs #802
2020-06-05 16:55:08 -07:00
Simon Willison
f786033a5f
Fixed 'datasette plugins' command, with tests - closes #802
2020-06-05 16:46:37 -07:00
Simon Willison
033a1bb22c
Removed rogue print() from test
2020-06-05 12:06:43 -07:00
Simon Willison
84a9c4ff75
CSRF protection ( #798 )
...
Closes #793 .
* Rename RequestParameters to MultiParams, refs #799
* Allow tuples as well as lists in MultiParams, refs #799
* Use csrftokens when running tests, refs #799
* Use new csrftoken() function, refs https://github.com/simonw/asgi-csrf/issues/7
* Check for Vary: Cookie hedaer, refs https://github.com/simonw/asgi-csrf/issues/8
2020-06-05 12:05:57 -07:00
Simon Willison
d96ac1d52c
Allow tuples as well as lists in MultiParams, refs #799
2020-06-05 11:01:06 -07:00
Simon Willison
0da7f49b24
Rename RequestParameters to MultiParams, refs #799
2020-06-05 10:52:50 -07:00
Simon Willison
9cb44be42f
Docs and tests for "params", closes #797
2020-06-03 14:04:40 -07:00
Simon Willison
aa82d03704
Basic writable canned queries
...
Refs #698 . First working version of this feature.
* request.post_vars() no longer discards empty values
2020-06-03 08:16:50 -07:00
Simon Willison
0934844c0b
request.post_vars() no longer discards empty values
2020-06-03 06:48:39 -07:00
Simon Willison
a7137dfe06
/-/plugins now shows details of hooks, closes #794
...
Also added /-/plugins?all=1 parameter to see default plugins.
2020-06-02 14:49:28 -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
4fa7cf6853
Flash messages mechanism, closes #790
2020-06-02 14:12:18 -07:00
Simon Willison
dfdbdf378a
Added /-/permissions debug tool, closes #788
...
Also started the authentication.rst docs page, refs #786 .
Part of authentication work, refs #699 .
2020-05-31 22:00:36 -07:00
Simon Willison
9f3d4aba31
--root option and /-/auth-token view, refs #784
2020-05-31 18:16:42 -07:00
Simon Willison
fa27e44fe0
datasette.sign() and datasette.unsign() methods, refs #785
2020-05-31 18:16:42 -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
4d798ca0e3
Added test for db.mtime_ns
2020-05-30 11:17:20 -07:00
Simon Willison
de1cde65a6
Moved request tests to test_internals_request.py
2020-05-30 10:45:11 -07:00
Simon Willison
ca56c226a9
Renamed test_database.py to test_internals_database.py
...
Also added a db fixture to remove some boilerplate.
2020-05-30 07:33:02 -07:00
Simon Willison
31fb006a9b
Added datasette.get_database() method
...
Refs #576
2020-05-30 07:29:59 -07:00
Simon Willison
81be31322a
New implementation for RequestParams
...
- no longer subclasses dict
- request.args[key] now returns first item, not all items
- removed request.raw_args entirely
Closes #774
2020-05-29 16:22:22 -07:00
Simon Willison
84616a2364
request.args.getlist() returns [] if missing, refs #774
...
Also added some unit tests for request.args
2020-05-29 15:51:30 -07:00
Simon Willison
7bb30c1f11
request.url now respects force_https_urls, closes #781
2020-05-28 10:10:06 -07:00
Simon Willison
5ab411c733
can_render mechanism for register_output_renderer, closes #770
2020-05-27 22:57:05 -07:00
Simon Willison
75cd432e5a
Ability to set custom table/view page size in metadata, closes #751
2020-05-27 22:00:04 -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
446e5de65d
Refactored test plugins into tests/plugins, closes #775
2020-05-27 17:57:25 -07:00
Simon Willison
ad88c9b3f3
Mechanism for adding a default URL fragment to a canned query
...
Closes #767
2020-05-27 14:52:03 -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
41a0cd7b6a
call_with_supported_arguments() util, refs #581
2020-05-27 12:25:52 -07:00
Simon Willison
5ea8c6d1cd
type-pk instead of type-link CSS class, closes #729
2020-05-14 22:55:20 -07:00
Simon Willison
504196341c
Visually distinguish float/int columns, closes #729
2020-05-14 22:51:39 -07:00
Simon Willison
2694ddcf14
Test for .execute_fn(), refs #685
2020-05-08 10:29:17 -07:00
Simon Willison
4433306c18
Improvements + docs for db.execute() and Results class
...
* Including new results.first() and results.single_value() methods. Closes #685
2020-05-08 09:05:46 -07:00
Simon Willison
0784f2ef9d
Allow specific pragma functions, closes #761
2020-05-06 10:18:31 -07:00
Simon Willison
cc872b1f50
Fixed rogue output in tests, closes #755
2020-05-04 11:42:01 -07:00
Simon Willison
9424687e9e
Consistently return charset utf-8, closes #752
2020-05-04 10:42:10 -07:00
Simon Willison
450d2e2896
Fixed pytest warning about TestClient class
2020-05-04 10:42:10 -07:00
Simon Willison
cef23e8861
Started pattern portfolio at /-/patterns, refs #151
2020-05-02 20:05:25 -07:00
Simon Willison
b3aa5f4313
Added 'not like' table filter, refs #750
2020-05-02 12:04:54 -07:00
Simon Willison
1d91ab71d4
Directory configuration mode supports metadata.yaml, closes #747
2020-04-30 11:47:41 -07:00
Simon Willison
89c4ddd482
403 for static directory listing, closes #740
2020-04-27 11:29:04 -07:00
Simon Willison
25014ca25e
Configuration directory mode, closes #731
2020-04-27 09:30:24 -07:00
Simon Willison
1b7b66c465
Make request available when rendering custom pages, closes #738
2020-04-26 12:01:46 -07:00
Simon Willison
304e7b1d9f
Mechanism for creating custom pages using templates
...
Closes #648
2020-04-26 11:46:43 -07:00
Simon Willison
15e2321804
Extra body CSS class for canned queries, closes #727
2020-04-15 14:07:28 -07:00
Simon Willison
d349d57cdf
Smarter merging of metadata and extra_metadata, closes #724
2020-04-10 11:34:09 -07:00
Simon Willison
d55fe8cdfc
Fixed bug with Templates considered comment, closes #689
2020-04-05 12:38:33 -07:00
Simon Willison
e89b0ef2f9
Expose extra_template_vars in _contex=1, refs #693
2020-04-05 11:49:15 -07:00
Simon Willison
09253817de
Fix for missing view_name bug, closes #716
2020-04-05 11:28:20 -07:00
Simon Willison
e0e7a0facf
Removed Zeit Now v1 support, closes #710
2020-04-04 16:04:33 -07:00
Simon Willison
b07312c2b3
dedent SQL for neighborhood_search fixture
...
Makes this page a little prettier:
https://latest.datasette.io/fixtures/neighborhood_search
2020-04-02 17:54:27 -07:00
Simon Willison
6717c719dd
--metadata accepts YAML as well as JSON - closes #713
2020-04-02 12:30:53 -07:00
Simon Willison
2aaad72789
Refactor template setup into Datasette constructor
...
Closes #707
2020-03-26 18:12:43 -07:00
Simon Willison
6aa516d82d
Run base_url tests against /fixtures/facetable too, refs #712
2020-03-25 19:31:22 -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
5f4aeb1f19
Removed documentation for Zeit Now v1, refs #710
2020-03-24 15:45:24 -07:00
Simon Willison
a498d0fe65
Fix bug with over-riding default sort, closes #702
2020-03-21 19:40:29 -07:00
Simon Willison
236aa065b2
"sort" and "sort_desc" metadata properties, closes #702
2020-03-21 19:28:35 -07:00
Simon Willison
e1a817411a
Bump to click 7.1.1 to fix flaky tests
2020-03-21 18:47:51 -07:00
Simon Willison
2c0e1e09bc
Show sort arrow on primary key by default
...
Closes #677 . Refs #702 .
2020-03-21 16:57:37 -07:00
Simon Willison
a000c80d50
await Request(scope, receive).post_vars() method, closes #700
...
Needed for #698
2020-03-16 19:47:37 -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
ddd11b3ddd
--memory option for publish cloudrun, refs #694
2020-03-05 17:34:36 -06:00
Simon Willison
7f5a330377
Don't count rows on homepage for DBs > 100MB ( #688 )
...
Closes #649 .
2020-02-28 17:08:29 -08:00
Kevin Keogh
3041c6b641
Use inspect-file, if possible, for total row count ( #666 )
...
For large tables, counting the number of rows in the table can take a
significant amount of time. Instead, where an inspect-file is provided
for an immutable database, look up the row-count for a plain count(*).
Thanks, @kevindkeogh
2020-02-25 12:19:29 -08:00
Simon Willison
6cb65555f4
?_searchmode=raw option ( #686 )
2020-02-24 21:56:03 -08:00
Simon Willison
a093c5f79f
.execute_write() and .execute_write_fn() methods on Database ( #683 )
...
Closes #682 .
2020-02-24 20:45:07 -08:00
Simon Willison
7c6a9c3529
Better tests for prepare_connection() plugin hook, refs #678
2020-02-21 18:27:07 -08:00
Simon Willison
d3f2fade88
Refactored run_sanity_checks to check_connection(conn), refs #674
2020-02-15 09:56:48 -08:00
Simon Willison
cf5f4386ef
Run black against everything, not just tests and datasette dirs
2020-02-13 15:02:10 -08:00
Jay Graves
33a12c8ae5
Allow leading comments in SQL input field ( #653 )
...
Thanks, @jaywgraves!
2020-02-04 18:13:24 -08:00
Simon Willison
67fc9c5720
--port argument for datasette package, plus tests - closes #661
...
From pull request #663
2020-01-29 14:46:43 -08:00
Katie McLaughlin
34d77d780f
gcloud run is now GA, s/beta// ( #660 )
...
Thanks, @glasnt
2020-01-21 15:28:11 -08:00
Simon Willison
3c861f363d
_search= queries now correctly escaped, fixes #651
...
Queries with reserved words or characters according to the SQLite
FTS5 query language could cause errors.
Queries are now escaped like so:
dog cat => "dog" "cat"
2019-12-29 18:48:30 +00:00
Simon Willison
d54318fc7f
Added template_debug setting, closes #654
2019-12-22 16:04:45 +00:00
Simon Willison
d6b6c9171f
Include asyncio task information in /-/threads debug page
2019-12-04 22:47:17 -08:00
Simon Willison
d3e1c3017e
Display 0 results, closes #637
2019-11-22 22:07:01 -08:00
Simon Willison
fd137da7f8
Suggest column facet only if at least one count > 1
...
Fixes #638
2019-11-21 16:56:55 -08:00
Simon Willison
440a70428c
Include rowid in filter select, closes #636
2019-11-19 15:01:10 -08:00
Simon Willison
8c642f04e0
Render templates using Jinja async mode
...
Closes #628
2019-11-14 15:14:22 -08:00
Simon Willison
f524510230
Fix "publish heroku" + upgrade to use Python 3.8.0
...
Closes #633 . Closes #632 .
2019-11-13 08:42:47 -08:00
Simon Willison
d977fbadf7
datasette publish uses python:3.8 base Docker image, closes #629
2019-11-11 22:03:09 -08:00
Simon Willison
cf7776d36f
Support Python 3.8, stop supporting Python 3.5 ( #627 )
...
* Upgrade to uvicorn 0.10.4
* Drop support for Python 3.5
* Bump all dependencies to latest releases
* Update docs to reflect we no longer support 3.5
* Removed code that skipped black unit test on 3.5
Closes #622
2019-11-11 21:09:11 -08:00
Simon Willison
28c4a6db5b
CREATE INDEX statements on table page, closes #618
2019-11-09 17:29:36 -08:00
Simon Willison
83fc5165ac
Improved UI for publish cloudrun, closes #608
2019-11-07 18:48:39 -08:00
Tobias Kunze
931bfc6661
Handle spaces in DB names ( #590 )
...
Closes #503 - thanks, @rixx
2019-11-04 15:16:30 -08:00
Simon Willison
52fa79c607
Use select colnames, not select * for table view - refs #615
2019-11-04 15:03:48 -08:00
Simon Willison
9db22cdf18
pk__notin= filter, closes #614
2019-11-03 20:11:55 -08:00
Simon Willison
2bf7ce5f51
Fix CSV export for nullable foreign keys, closes #612
2019-11-02 16:12:46 -07:00
Simon Willison
14da70525b
Don't show 'None' as label for nullable foreign key, closes #406
2019-11-02 15:29:40 -07:00
Simon Willison
7152e76eda
Don't suggest array facet if column is only [], closes #610
2019-11-01 14:45:59 -07:00
Simon Willison
50287e7c6b
Only suggest array facet for arrays of strings - closes #562
2019-11-01 12:37:46 -07:00
Simon Willison
e2c390500e
Persist _where= in hidden fields, closes #604
2019-10-30 11:49:26 -07:00
Simon Willison
5dd4d2b2d3
Update to latest black ( #609 )
2019-10-30 11:49:01 -07:00
chris48s
f4c0830529
Always pop as_format off args dict ( #603 )
...
Closes #563 . Thanks, @chris48s
2019-10-20 19:03:08 -07:00
Simon Willison
b647b5efc2
Fix for /foo v.s. /foo-bar issue, closes #597
...
Pull request #599
2019-10-18 15:51:07 -07:00
Simon Willison
b6ad1fdc70
Fixed bug returning non-ascii characters in CSV, closes #584
2019-10-17 22:23:01 -07:00
Simon Willison
3e864b1625
Use --platform=managed for publish cloudrun, closes #587
2019-10-17 14:51:45 -07:00
Tobias Kunze
12cec411ca
Display metadata footer on custom SQL queries ( #589 )
...
Closes #408 - thanks, @rixx!
2019-10-13 20:53:21 -07:00
Tobias Kunze
908fc3999e
Sort databases on homepage by argument order - #591
...
Closes #585 - thanks, @rixx!
2019-10-13 20:52:33 -07:00
Simon Willison
fffd69ec03
Allow EXPLAIN WITH... - closes #583
2019-10-06 10:23:58 -07:00
Simon Willison
2dc5c8dc25
detect_fts now works with alternative table escaping ( #571 )
...
Fixes #570 . See also https://github.com/simonw/sqlite-utils/pull/57
2019-09-02 17:32:27 -07:00
Simon Willison
90d4f497f9
Fix plus test for unicode characters in custom query name, closes #558
2019-07-13 19:49:24 -07:00
Abdus
74ecf8a7cc
Fix static mounts using relative paths and prevent traversal exploits ( #554 )
...
Thanks, @abdusco! Closes #555
2019-07-11 09:13:19 -07:00
Simon Willison
973f8f139d
--plugin-secret option for datasette publish
...
Closes #543
Also added new --show-files option to publish now and publish cloudrun - handy for debugging.
2019-07-07 19:06:31 -07:00
Simon Willison
c5542abba5
Removed ManyToManyFacet for the moment, closes #550
2019-07-07 16:21:11 -07: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
13e4f9a676
Unit test for _table custom template, refs #521
2019-07-02 20:23:05 -07:00