Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
32e8fea3
Kaydet (Commit)
32e8fea3
authored
Ock 07, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update the digest of PEP 3333 based on comments for Phillip Eby.
üst
2f2a9f77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
3.2.rst
Doc/whatsnew/3.2.rst
+23
-9
No files found.
Doc/whatsnew/3.2.rst
Dosyayı görüntüle @
32e8fea3
...
...
@@ -376,18 +376,32 @@ the bodies of requests and responses.
The *native strings* are always of type :class:`str` but are restricted to code
points between *u0000* through *u00FF* which are translatable to bytes using
*Latin-1* encoding. These strings are used with :func:`start_response` as
response headers or statuses and must follow :rfc:`2616` with respect to
*Latin-1* encoding. These strings are used for the keys and values in the
environ dictionary and for response headers and statuses in the
:func:`start_response` function. They must follow :rfc:`2616` with respect to
encoding. That is, they must either be *ISO-8859-1* characters or use
:rfc:`2047` MIME encoding.
To make the environment accessible using native strings, the :mod:`wsgiref`
module has a new function, :func:`wsgiref.handlers.read_environ` which
transcodes CGI variables from :attr:`os.environ` into native strings and returns
a new dictionary. This function provides a WSGI native string friendly
abstraction which is especially helpful given that the environment variables are
handled differently on various operating systems (native unicode on Windows or
UTF-8 encoded bytes on some Unix installations).
For developers porting WSGI applications from Python 2, here are the salient
points:
* If the app already used strings for headers in Python 2, no change is needed.
* If instead, the app encoded output headers or decoded input headers, then the
headers will need to be re-encoded to Latin-1. For example, an output header
encoded in utf-8 was using ``h.encode('utf-8')`` now needs to convert from
bytes to native strings using ``h.encode('utf-8').decode('latin-1')``.
* Values yielded by an application or sent using the :meth:`write` method
must be byte strings. The :func:`start_response` function and environ
must use native strings. The two cannot be mixed.
For server implementers writing CGI-to-WSGI pathways or other CGI-style
protocols, the users must to be able access the environment using native strings
eventhough the underlying platform may have a different convention. To bridge
this gap, the :mod:`wsgiref` module has a new function,
:func:`wsgiref.handlers.read_environ` for transcoding CGI variables from
:attr:`os.environ` into native strings and returning a new dictionary.
.. seealso::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment