ploneasgi.app#

Compose the ASGI application.

The whole extension story is create_app()'s keyword arguments. There is deliberately no registration framework, no entry-point scanning and no middleware registry: the moment this grows one, PasteDeploy has been reinvented with extra steps. Adding a route means passing a route.

ploneasgi.zcml lets an add-on declare a route — it has no server.py to edit — but nothing here looks for them. The project calls ploneasgi.zcml.routes_from_registry() and passes the result to routes, so this function still only ever sees a list someone handed it.

ploneasgi.app.LifespanFactory#

Signature of a lifespan factory: called with the app, used as a context manager for the lifetime of the server. What @asynccontextmanager returns — not the bare async generator underneath it.

alias of Callable[[Any], AbstractAsyncContextManager[None]]

ploneasgi.app.AdapterFactory#

Builds the ASGI app that mounts a WSGI app; see default_adapter().

alias of Callable[[Callable[[...], Iterable[bytes]], Settings], Callable[[MutableMapping[str, Any], Callable[[], Awaitable[MutableMapping[str, Any]]], Callable[[MutableMapping[str, Any]], Awaitable[None]]], Awaitable[None]]]

ploneasgi.app.default_adapter(wsgi_app, settings)[source]#

Wrap a WSGI app in this package's adapter.

Parameters:
  • wsgi_app (Callable[[...], Iterable[bytes]]) -- The WSGI application to mount.

  • settings (Settings) -- Settings providing concurrency, chunk size and the request body limit.

Returns:

The configured adapter.

Return type:

WSGIMiddleware

ploneasgi.app.create_app(settings=None, *, routes=(), middleware=(), lifespans=(), wsgi_app=None, adapter=None)[source]#

Build the Starlette application with Zope mounted at /.

Parameters:
Returns:

The composed Starlette application.

Return type:

Starlette

ploneasgi.app.serve(app, settings=None)[source]#

Run the application under uvicorn.

Parameters:
  • app (Starlette) -- The application to serve.

  • settings (Settings | None) -- Settings providing host, port and log level.

Return type:

None