Wykres commitów

94 Commity (main)

Autor SHA1 Wiadomość Data
Agustin Bacigalup 67e66f36c1
Add ETag header for static responses (#2306)
* add etag to static responses

* fix RuntimeError related to static headers

* Remove unnecessary import

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2024-03-17 12:18:40 -07:00
Simon Willison 5c64af6936 Upgrade to latest Black, closes #2239 2024-01-30 19:55:26 -08:00
Simon Willison 527cec66b0 utils.pairs_to_nested_config(), refs #2156, #2143 2023-08-24 11:21:15 -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 55a709c480 Allow leading comments on SQL queries, refs #1860 2022-10-26 14:34:33 -07:00
Simon Willison d0737e4de5 truncate_cells_html now affects URLs too, refs #1805 2022-09-06 16:50:43 -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 798f075ef9 Read format from route captures, closes #1667
Refs #1660
2022-03-19 13:32:29 -07:00
Simon Willison a35393b29c
Tilde encoding (#1659)
Closes #1657

Refs #1439
2022-03-15 11:01:57 -07:00
Simon Willison 5a353a32b9 Revert "Fixed tests for urlsafe_components, refs #1650"
This reverts commit bb499942c1.

Refs #1658
2022-03-15 08:37:14 -07:00
Simon Willison bb499942c1 Fixed tests for urlsafe_components, refs #1650 2022-03-07 11:33:31 -08:00
Simon Willison 1baa030eca
Switch to dash encoding for table/database/row-pk in paths
* Dash encoding functions, tests and docs, refs #1439
* dash encoding is now like percent encoding but with dashes
* Use dash-encoding for row PKs and ?_next=, refs #1439
* Use dash encoding for table names, refs #1439
* Use dash encoding for database names, too, refs #1439

See also https://simonwillison.net/2022/Mar/5/dash-encoding/
2022-03-07 07:38:29 -08:00
Simon Willison 63537dd3de Allow 'explain query plan' with more whitespace, closes #1588 2022-01-13 12:34:55 -08:00
Simon Willison b1fed48a95 derive_named_parameters falls back to regex on SQL error, refs #1421 2021-08-08 20:26:08 -07:00
Simon Willison fc4846850f New way of deriving named parameters using explain, refs #1421 2021-08-08 20:21:13 -07:00
Simon Willison 121e10c29c Doumentation and test for utils.parse_metadata(), closes #1405 2021-07-29 16:30:12 -07:00
Simon Willison 0f1e47287c Fixed bug with detect_fts for table with single quote in name, closes #1257 2021-06-01 20:27:04 -07:00
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 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 11eb1e026f datasette.urls.table(..., format="json"), closes #1035
Also improved tests for datasette.urls and added format= to some other methods
2020-10-31 11:16:28 -07:00
Simon Willison 178b7e8749 .csv now links to .blob downloads
Closes #1063, closes #1034
2020-10-29 15:47:32 -07:00
Simon Willison f5dbe61a45 -o now opens to most relevant page, closes #976 2020-10-25 22:06:20 -07:00
Simon Willison 5b8b8ae597 Handle \r\n correctly in CSS escapes, refs #980 2020-09-29 12:16:30 -07:00
Simon Willison c11383e628 Fix rendering glitch with columns on mobile, closes #978 2020-09-28 15:42:50 -07:00
Simon Willison 092874202c Improvements to allow block logic and debug tool
true and false allow block values are now supported, closes #906

Added a bunch of demo links to the documentation, refs #908
2020-07-24 17:04:06 -07:00
Simon Willison 2115d7e345 Logout link in nav, refs #875 2020-06-29 11:40:40 -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 f39f111331 Fixed actor_matches_allow bug, closes #836 2020-06-11 15:47:19 -07:00
Simon Willison 98632f0a87
--secret command for datasette publish
Closes #787
2020-06-11 09:02:03 -07:00
Simon Willison 198545733b Document that "allow": {} denies all
https://github.com/simonw/datasette/issues/831#issuecomment-642324847
2020-06-10 16:56:53 -07:00
Simon Willison 7633b9ab24 unauthenticated: true method plus allow block docs, closes #825 2020-06-09 10:01:03 -07:00
Simon Willison eb3ec279be
Test for anonymous: true, refs #825 2020-06-08 23:33:06 -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 f786033a5f Fixed 'datasette plugins' command, with tests - closes #802 2020-06-05 16:46:37 -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 de1cde65a6 Moved request tests to test_internals_request.py 2020-05-30 10:45:11 -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 41a0cd7b6a call_with_supported_arguments() util, refs #581 2020-05-27 12:25:52 -07:00
Simon Willison 0784f2ef9d Allow specific pragma functions, closes #761 2020-05-06 10:18:31 -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 d3f2fade88 Refactored run_sanity_checks to check_connection(conn), refs #674 2020-02-15 09:56:48 -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 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 fffd69ec03 Allow EXPLAIN WITH... - closes #583 2019-10-06 10:23:58 -07:00