THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
module documentation
Undocumented
| Function | _is |
Accept a local path or an absolute reference with the application origin. |
| Function | _url |
Extract the normalized scheme, hostname, and effective port of a URL. |
| Function | previous |
Resolve the page a failed submission should be redirected back to. |
| Async Function | validation |
Translate a schema validation failure into an HTTP response. |
| Constant | _DEFAULT |
Undocumented |
| Constant | _DELETE |
Undocumented |
| Constant | _FIRST |
Undocumented |
Extract the normalized scheme, hostname, and effective port of a URL.
| Parameters | |
url:str | Absolute URL whose origin is compared with the application origin. |
| Returns | |
tuple[str, str | None, int | None] | Scheme, lowercase hostname, and explicit or default port. |
| Raises | |
ValueError | If the authority or port is malformed or contains user credentials. |
Resolve the page a failed submission should be redirected back to.
Resolution order: the last page recorded by the session middleware, the referring URL when it belongs to this application, and finally the URL the form was submitted to.
| Parameters | |
request:Request | Incoming HTTP request. |
| Returns | |
str | Absolute URL or path to redirect back to. |
async def validation_response(exc:
ValidationException, request: Request, responses: IDefaultResponses) -> Response:
(source)
¶
Translate a schema validation failure into an HTTP response.
JSON and AJAX clients receive the structured 422 payload, while browsers are redirected back to the submitted form with the errors and the previous input flashed into the session.
| Parameters | |
exc:ValidationException | Failure carrying every field error found in the payload. |
request:Request | Incoming HTTP request. |
responses:IDefaultResponses | Default response factory used to render the error payload. |
| Returns | |
Response | A 422 response, or a 302 redirect back to the previous page. |