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
8b73fc6b47
Put AsgiLifestyle back so server starts up again, refs #1955
2022-12-17 17:22:00 -08:00
Simon Willison
63fb750f39
Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955
2022-12-17 14:14:34 -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
ee64130fa8
Refactor to use new resolve_database/table/row methods, refs #1896
2022-11-18 14:46:25 -08: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
a6ff123de5
keep_blank_values=True when parsing query_string, closes #1551
...
Refs #1518
2021-12-12 12:01:51 -08:00
Simon Willison
ff0dd4da38
repr() method for Request, refs #1519
2021-11-19 12:29:37 -08:00
Simon Willison
b267b57754
Upgrade to httpx 0.20
...
* Upgrade to httpx 0.20, closes #1488
* TestClient.post() should not default to following redirects
2021-10-14 11:03:44 -07:00
Simon Willison
dd5ee8e668
Removed some unused imports
...
I found these with:
flake8 datasette | grep unus
2021-07-15 23:26:12 -07:00
Simon Willison
8e8fc5cee5
Applied Black
2021-01-11 13:34:38 -08:00
Simon Willison
649f48cd70
request.full_path property, closes #1184
2021-01-11 13:32:58 -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
Abdussamet Koçak
705d1a1555
Fix startup error on windows ( #1128 )
...
Fixes https://github.com/simonw/datasette/issues/1094
This import isn't used at all, and causes error on startup on Windows.
2020-12-05 11:35:03 -08:00
Simon Willison
ca6e8e53dc
More helpful 404 messages, refs #1124
2020-12-03 11:05:12 -08:00
Simon Willison
63efcb35ce
More tweaks to root_path handling, refs #1124
2020-12-03 11:02:53 -08:00
Simon Willison
6b4c55efea
Fix for Amazon Linux static assets 404ing, refs #1124
2020-12-03 10:53:26 -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
84bc7244c1
datasette.client now applies base_url, closes #1026
2020-10-31 12:29:42 -07:00
Simon Willison
78b3eeaad9
.blob output renderer
...
* _blob_hash= checking plus refactored to use new BadRequest class, refs #1050
* Replace BlobView with new .blob renderer, closes #1050
* .blob downloads on arbitrary queries, closes #1051
2020-10-29 15:01:38 -07:00
Simon Willison
c3aba4aa98
--cors for /name.db downloads, refs #1057
2020-10-27 13:39:57 -07:00
Simon Willison
0748a65a22
Fixed content-disposition header on DB download, closes #909
2020-07-29 14:34:22 -07:00
Simon Willison
213e6a8926
content-length for DB downloads, closes #905
2020-07-21 21:52:35 -07:00
Simon Willison
1f6a134369
await request.post_body() method, closes #897
2020-07-17 13:12:35 -07:00
Simon Willison
4dad028432
BaseView.as_asgi is now .as_view, refs #870
2020-06-28 16:47:40 -07:00
Simon Willison
3bc2461c77
Refactored AsgiView into BaseView, refs #870
2020-06-28 16:06:30 -07:00
Simon Willison
a8bcafc177
Refactored out AsgiRouter, refs #870
2020-06-28 13:45:17 -07:00
Simon Willison
008e2f63c2
response.set_cookie(), closes #795
2020-06-09 15:19:37 -07:00
Simon Willison
fac8e93815
request.url_vars property, closes #822
2020-06-08 20:40:00 -07:00
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
177059284d
New request.actor property, refs #811
2020-06-08 10:05:32 -07:00
Simon Willison
86dec9e8ff
Added permission check to every view, closes #808
2020-06-06 22:30:36 -07:00
Simon Willison
0da7f49b24
Rename RequestParameters to MultiParams, refs #799
2020-06-05 10:52:50 -07:00
Simon Willison
0934844c0b
request.post_vars() no longer discards empty values
2020-06-03 06:48:39 -07:00
Simon Willison
4fa7cf6853
Flash messages mechanism, closes #790
2020-06-02 14:12:18 -07:00
Simon Willison
1d0bea157a
New request.cookies property
2020-06-02 14:11:41 -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
50652f474b
Stop using .raw_args, deprecate and undocument it - refs #706
2020-05-27 15:29:42 -07:00
Simon Willison
9424687e9e
Consistently return charset utf-8, closes #752
2020-05-04 10:42:10 -07:00
Colin Dellow
dbd2d70b38
asgi: check raw_path is not None ( #719 )
...
The ASGI spec
(https://asgi.readthedocs.io/en/latest/specs/www.html#http ) seems to
imply that `None` is a valid value, so we need to check the value
itself, not just whether the key is present.
In particular, the [mangum](https://github.com/erm/mangum ) adapter
passes `None` for this key.
2020-05-04 10:14:25 -07:00
Simon Willison
89c4ddd482
403 for static directory listing, closes #740
2020-04-27 11:29:04 -07:00
Simon Willison
304e7b1d9f
Mechanism for creating custom pages using templates
...
Closes #648
2020-04-26 11:46:43 -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
a000c80d50
await Request(scope, receive).post_vars() method, closes #700
...
Needed for #698
2020-03-16 19:47:37 -07:00
Simon Willison
dc80e779a2
Handle scope path if it is a string
...
I ran into this while running a unit test with httpx.AsyncClient
2020-03-02 15:34:04 -08:00
Simon Willison
b6ad1fdc70
Fixed bug returning non-ascii characters in CSV, closes #584
2019-10-17 22:23:01 -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
Simon Willison
cc27857c72
Removed unused variable
2019-07-11 09:14:24 -07:00