mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
.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
This commit is contained in:
parent
d6f9ff7137
commit
78b3eeaad9
12 changed files with 165 additions and 121 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
from os import EX_CANTCREAT
|
||||
from datasette.utils import MultiParams
|
||||
from mimetypes import guess_type
|
||||
from urllib.parse import parse_qs, urlunparse, parse_qsl
|
||||
|
|
@ -15,12 +16,20 @@ Morsel._reserved["samesite"] = "SameSite"
|
|||
# https://github.com/encode/starlette/blob/519f575/starlette/responses.py#L17
|
||||
|
||||
|
||||
class NotFound(Exception):
|
||||
pass
|
||||
class Base400(Exception):
|
||||
status = 400
|
||||
|
||||
|
||||
class Forbidden(Exception):
|
||||
pass
|
||||
class NotFound(Base400):
|
||||
status = 404
|
||||
|
||||
|
||||
class Forbidden(Base400):
|
||||
status = 403
|
||||
|
||||
|
||||
class BadRequest(Base400):
|
||||
status = 400
|
||||
|
||||
|
||||
SAMESITE_VALUES = ("strict", "lax", "none")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue