tilie_server.manifests#
Reading what a request posts, the manifest in it, and refusing a request.
The editor posts a manifest file’s text, in any serialization timetoshare
reads, with every ID written #id. timetoshare’s reader is imported when
a request needs it, so a server whose installed timetoshare lacks it still
starts and answers every other route; a route needing it then answers 501.
timetoshare is no direct requirement of the server: timetoalign requires it.
The routes that compute their answer from a posted body are plain functions,
which the framework runs on its thread pool, so that a long computation
leaves the event loop free for every other request; they take the body as a
PostedBody, which reads it on the event loop. A server may limit how
many such computations run at once: a computation beyond the limit waits on
the event loop, holding no worker thread, until one ends.
- exception tilie_server.manifests.Refusal(path, message, status_code=422, problems=None)[source]#
Bases:
ExceptionA request a route cannot answer, with the path of what it refuses and, for a refused table, every problem found in it.
- Parameters:
- Return type:
None
- async tilie_server.manifests.posted_body(request)[source]#
The request’s body, exactly as sent, while the computation on it may run.
Where the server limits its computations (
app.state.computations, a semaphore), the request first waits for its turn, and keeps it until the route function has returned.- Parameters:
request (Request)
- Return type:
- tilie_server.manifests.PostedBody#
A route’s parameter taking the posted body, the one way a computing route takes it. The turn ends when the route function returns, before the answer is sent, so a client that reads slowly holds no computation’s place.
alias of
Annotated[bytes,Depends(dependency=posted_body, use_cache=True, scope=function)]
- tilie_server.manifests.read_manifest(body, what='the body')[source]#
Read a posted manifest file in any serialization.
- Parameters:
- Returns:
The manifest as its file writes it (IDs
#id), and the same manifest with every ID made bare.- Raises:
Refusal – 501 as
manifest_reader(); 422 if the bytes are no UTF-8 text, neither serialization reads it, it is no object, or an ID is not written in the file form (at timetoshare’s path).- Return type: