Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5847

Re: cgi cgitb Ersatz für Python 3.13

Path csiph.com!weretis.net!feeder8.news.weretis.net!news.szaf.org!thangorodrim.ancalagon.de!.POSTED.scatha.ancalagon.de!not-for-mail
From Thomas Hochstein <thh@thh.name>
Newsgroups de.comp.lang.python
Subject Re: cgi cgitb Ersatz für Python 3.13
Date Tue, 25 Oct 2022 20:05:22 +0200
Message-ID <dclp.20221025200520.1390@scatha.ancalagon.de> (permalink)
References <jrqjviFcgtkU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Info thangorodrim.ancalagon.de; posting-host="scatha.ancalagon.de:10.0.1.1"; logging-data="18895"; mail-complaints-to="abuse@th-h.de"
User-Agent ForteAgent/8.00.32.1272
X-NNTP-Posting-Date Tue, 25 Oct 2022 20:05:20 +0200
X-Face *OX>R5kq$7DjZ`^-[<HL?'n9%\ZDfCz/_FfV0_tpx7w{Vv1*byr`TC\[hV:!SJosK'1gA>1t8&@'PZ-tSFT*=<}JJ0nXs{WP<@(=U!'bOMMOH&Q0}/(W_d(FTA62<r"l)J\)9ERQ9?6|_7T~ZV2Op*UH"2+1f9[va
Cancel-Lock sha1:yCCZS+d/VvTpFAkOzvt3TPIZaE8=
X-Clacks-Overhead GNU Terry Pratchett
Xref csiph.com de.comp.lang.python:5847

Show key headers only | View raw


Hermann Riemann schrieb:

> In
> 
> https://docs.python.org/3.11/whatsnew/3.11.html
> 
> steht unter
> PEP 594 led to the deprecations of the following modules slated for 
> removal in Python 3.13:
> 
> cgi und cgitb
> 
> Ich benutze die beiden Funktionen meist um Daten, die in html
> zwischen <form> und </form> eingegeben werden, auszuwerten.
> 
> Auf was müsste ich umstellen?

Im "PEP 594" stehen die Gründe für die vorgesehene Entfernung der dort
genannten Module und vorgeschlagene Ersatzlösungen. Für cgi und cgitb gibt
es keinen unmittelbaren Ersatz. Vielmehr heißt es dazu: [1]

| cgi
|
| The cgi module is a support module for Common Gateway Interface (CGI)
| scripts. CGI is deemed as inefficient because every incoming request is
| handled in a new process. PEP 206 considers the module as:
|
|    "[…] designed poorly and are now near-impossible to fix (cgi) […]"

Das ist der Grund für die vorgesehene Entfernung.

| Replacements for the various parts of cgi which are not directly related
| to executing code are:
|
|  * parse with urllib.parse.parse_qs (parse is just a wrapper)
|  * parse_header with email.message.Message (see example below)
|  * parse_multipart with email.message.Message (same MIME RFCs)
|  * FieldStorage/MiniFieldStorage has no direct replacement, but can
|  * typically be replaced by using multipart (for POST and PUT requests)
|    or  urllib.parse.parse_qsl (for GET and HEAD requests)
|  * valid_boundary (undocumented) with re.compile("^[ -~]{0,200}[!-~]$")
|
| As an explicit example of how close parse_header and
| email.message.Message are:
|
| >>> from cgi import parse_header
| >>> from email.message import Message
| >>> parse_header(h)
| ('application/json', {'charset': 'utf8'})
| >>> m = Message()
| >>> m['content-type'] = h
| >>> m.get_params()
| [('application/json', ''), ('charset', 'utf8')]
| >>> m.get_param('charset')
| 'utf8'
| 
|cgitb
|
| The cgitb module is a helper for the cgi module for configurable
| tracebacks.
| 
| The cgitb module is not used by any major Python web framework (Django,
| Pyramid, Plone, Flask, CherryPy, or Bottle). Only Paste uses it in an
| optional debugging middleware.

-thh

[1] Webseiten vorlesen ist irgendwie doof.

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

cgi cgitb Ersatz für Python 3.13 Hermann Riemann <nospam.ng@hermann-riemann.de> - 2022-10-25 19:16 +0200
  Re: cgi cgitb Ersatz für Python 3.13 Thomas Hochstein <thh@thh.name> - 2022-10-25 20:05 +0200
    Re: cgi cgitb Ersatz für Python 3.13 "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2022-10-25 22:56 +0200
    [Python-de] Re: cgi cgitb Ersatz für Python 3.13 Hartmut Goebel <h.goebel@goebel-consult.de> - 2022-10-26 09:22 +0200
      Re: [Python-de] Re: cgi cgitb Ersatz für Python 3.13 Thomas Orgelmacher <trash@odbs.org> - 2022-10-29 22:20 +0200
      [Python-de] Re: cgi cgitb Ersatz für Python 3.13 "Massa, Harald Armin" <chef@ghum.de> - 2022-10-29 22:45 +0200
        [Python-de] Re: cgi cgitb Ersatz für Python 3.13 imsoniyasharma01@gmail.com - 2022-11-06 06:29 +0000
  [Python-de] Re: cgi cgitb Ersatz für Python 3.13 imsoniyasharma01@gmail.com - 2022-11-06 06:27 +0000

csiph-web