Skip to content

Commit

Permalink
wsgiref: indicate that start_response objects should follow a speci…
Browse files Browse the repository at this point in the history
…fic protocol
  • Loading branch information
picnixz committed Dec 2, 2024
1 parent bf21e21 commit e55acbb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Doc/library/wsgiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ in type annotations.
applications to set up dummy environments. It should NOT be used by actual WSGI
servers or applications, since the data is fake!

Example usage::
Example usage, where the *start_response* callable should follow the

Check warning on line 122 in Doc/library/wsgiref.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: StartResponse [ref.class]
:class:`StartResponse` protocol::

from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server
Expand Down Expand Up @@ -312,6 +313,9 @@ request. (E.g., using the :func:`shift_path_info` function from
as :mod:`wsgiref.simple_server`) is able to run a simple WSGI application
correctly.

The *start_response* callable should follow the :class:`StartResponse`

Check warning on line 316 in Doc/library/wsgiref.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: StartResponse [ref.class]
protocol.


.. class:: WSGIServer(server_address, RequestHandlerClass)

Expand Down Expand Up @@ -679,7 +683,9 @@ input, output, and error streams.

This method can access the current error using ``sys.exception()``,

Check warning on line 684 in Doc/library/wsgiref.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: StartResponse [ref.class]
and should pass that information to *start_response* when calling it (as
described in the "Error Handling" section of :pep:`3333`).
described in the "Error Handling" section of :pep:`3333`). In particular,
the *start_response* callable should follow the :class:`StartResponse`
protocol.

The default implementation just uses the :attr:`error_status`,
:attr:`error_headers`, and :attr:`error_body` attributes to generate an output
Expand Down Expand Up @@ -781,7 +787,7 @@ in :pep:`3333`.
.. versionadded:: 3.11


.. class:: StartResponse()
.. class:: StartResponse

A :class:`typing.Protocol` describing :pep:`start_response()
<3333#the-start-response-callable>`
Expand Down Expand Up @@ -816,7 +822,8 @@ in :pep:`3333`.
Examples
--------

This is a working "Hello World" WSGI application::
This is a working "Hello World" WSGI application, where the *start_response*
callable should follow the :class:`StartResponse` protocol::

"""
Every WSGI application must have an application object - a callable
Expand Down

0 comments on commit e55acbb

Please sign in to comment.