yimmo.Context

Contains the WSGI PEP3333 interface seen by python

Note

Yimmo WSGI function naming uses the following pattern:

  • python object methods: yimmo_Context_<method>

  • C-only functions to manipulate python objects: ymo_wsgi_ctx_<fn>

C Utility Functions

yimmo_context_t *ymo_wsgi_ctx_update_environ(PyObject *pEnviron, ymo_wsgi_exchange_t *exchange)

Update environ with values from exchange:

ymo_wsgi_exchange_t *ymo_wsgi_ctx_exchange(yimmo_context_t *ctx)

Return the exchange for this context.

yimmo.Context

class yimmo.Context

This class encapsulates the exchange information for a given session, as well as providing the input/output streams and other facilities required by PEP3333.

void yimmo_Context_dealloc(yimmo_context_t *self)
Context.__del__()
PyObject *yimmo_Context_start_response(yimmo_context_t *self, PyObject *const *args, Py_ssize_t nargs)
Context.start_response(status, response_headers, exc_info=None)

PEP 3333 start_response

PyObject *yimmo_Context_read(yimmo_context_t *self, PyObject *const *args, Py_ssize_t nargs)
Context.read(size=- 1)

Implements the PEP3333 read(size) method for wsgi.input. The semantics are the same as io.RawIOBase.read(size=-1).

The size parameter must be passed as a positional argument, not a kkwarg.

PyObject *yimmo_Context_readline(yimmo_context_t *self, PyObject *const *args, Py_ssize_t nargs)
Context.readline(size=- 1)

Implements the PEP3333 readline(size) method for wsgi.input. The semantics are the same as io.IOBase.readline(size=-1). The size parameter must be passed as a positional argument, not a kwarg.

PyObject *yimmo_Context_readlines(yimmo_context_t *self, PyObject *const *args, Py_ssize_t nargs)
Context.readlines(hint=- 1)

Implements the PEP3333 readlines(hint=-1) method for wsgi.input. The semantics are almost the same as io.IOBase.readlines(size=-1), save for the hint exception allowed by PEP3333: the hint parameter is ignored. The hint parameter must be passed as a positional argument, not a kkwarg.

PyObject *yimmo_Context_iter(yimmo_context_t *self)
Context.__iter__()

Support the iterator protocol for WSGI context request bodies.

PyObject *yimmo_Context_write(yimmo_context_t *self, PyObject *const *args, Py_ssize_t nargs)
Context.write(b)

PEP 3333: imperative write callback for content data (backwards compatibility for applications that don’t provide data as a return value).