8000 Docs: re-create cgi and cgitb pages to document their removal. · python/cpython@1c0fad3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c0fad3

Browse files
committed
Docs: re-create cgi and cgitb pages to document their removal.
This shows just two modules as an example. Will flesh it out with the rest of PEP 594 if people like the approach. Will also need to change the redirects that were created here: https://github.com/python/psf-salt/pull/521/files
1 parent 6293d00 commit 1c0fad3

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

Doc/library/cgi.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:mod:`!cgi` --- Common Gateway Interface support
2+
================================================
3+
4+
.. module:: cgi
5+
:synopsis: Removed in 3.13.
6+
:deprecated:
7+
8+
This module is no longer part of the Python standard library.
9+
It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after
10+
being deprecated in Python 3.11. The removal was decided in :pep:`594`.
11+
12+
A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`.
13+
14+
If you want to update your code using supported standard library modules:
15+
16+
* ``cgi.FieldStorage`` can typically be replaced with
17+
:func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the
18+
:mod:`email.message` module or :pypi:`multipart` PyPI project for ``POST``
19+
and ``PUT``.
20+
21+
* ``cgi.parse()`` can be replaced by calling :func:`urllib.parse.parse_qs`
22+
directly on the desired query string, except for ``multipart/form-data``
23+
input, which can be handled as described for ``cgi.parse_multipart()``.
24+
25+
* ``cgi.parse_multipart()`` can be replaced with the functionality in the
26+
:mod:`email` package (e.g. :class:`email.message.EmailMessage` and
27+
:class:`email.message.Message`) which implements the same MIME RFCs, or
28+
with the :pypi:`multipart` PyPI project.
29+
30+
* ``cgi.parse_header()`` can be replaced with the functionality in the
31+
:mod:`email` package, which implements the same MIME RFCs. For example,
32+
with :class:`email.message.EmailMessage`::
33+
34+
from email.message import EmailMessage
35+
msg = EmailMessage()
36+
msg['content-type'] = 'application/json; charset="utf8"'
37+
main, params = msg.get_content_type(), msg['content-type'].params

Doc/library/cgitb.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:mod:`!cgitb` --- Traceback manager for CGI scripts
2+
===================================================
3+
4+
.. module:: cgitb
5+
:synopsis: Removed in 3.13.
6+
:deprecated:
7+
8+
This module is no longer part of the Python standard library.
9+
It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after
10+
being deprecated in Python 3.11. The removal was decided in :pep:`594`.
11+
12+
A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`.

Doc/library/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ the `Python Package Index <https://pypi.org>`_.
7575
unix.rst
7676
cmdline.rst
7777
superseded.rst
78+
removed.rst
7879
security_warnings.rst

Doc/library/removed.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:tocdepth: 1
2+
3+
.. _removed:
4+
5+
***************
6+
Removed Modules
7+
***************
8+
9+
The modules described in this chapter have been removed from the Python
10+
standard library. They are documented here to help people find replacements.
11+
12+
13+
.. toctree::
14+
:maxdepth: 1
15+
16+
cgi.rst
17+
cgitb.rst

0 commit comments

Comments
 (0)
0