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
08898499
Kaydet (Commit)
08898499
authored
Mar 11, 2003
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
get_payload(): Teach this about various uunencoded
Content-Transfer-Encodings
üst
3840b49d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
Message.py
Lib/email/Message.py
+21
-10
No files found.
Lib/email/Message.py
Dosyayı görüntüle @
08898499
...
...
@@ -5,6 +5,7 @@
"""
import
re
import
uu
import
binascii
import
warnings
from
cStringIO
import
StringIO
...
...
@@ -165,13 +166,15 @@ class Message:
the list object, you modify the message's payload in place. Optional
i returns that index into the payload.
Optional decode is a flag (defaulting to False) indicating whether the
payload should be decoded or not, according to the
Content-Transfer-Encoding header. When True and the message is not a
multipart, the payload will be decoded if this header's value is
`quoted-printable' or `base64'. If some other encoding is used, or
the header is missing, or if the payload has bogus base64 data, the
payload is returned as-is (undecoded).
Optional decode is a flag indicating whether the payload should be
decoded or not, according to the Content-Transfer-Encoding header
(default is False).
When True and the message is not a multipart, the payload will be
decoded if this header's value is `quoted-printable' or `base64'. If
some other encoding is used, or the header is missing, or if the
payload has bogus data (i.e. bogus base64 or uuencoded data), the
payload is returned as-is.
If the message is a multipart and the decode flag is True, then None
is returned.
...
...
@@ -185,15 +188,23 @@ class Message:
if
decode
:
if
self
.
is_multipart
():
return
None
cte
=
self
.
get
(
'content-transfer-encoding'
,
''
)
if
cte
.
lower
()
==
'quoted-printable'
:
cte
=
self
.
get
(
'content-transfer-encoding'
,
''
)
.
lower
()
if
cte
==
'quoted-printable'
:
return
Utils
.
_qdecode
(
payload
)
elif
cte
.
lower
()
==
'base64'
:
elif
cte
==
'base64'
:
try
:
return
Utils
.
_bdecode
(
payload
)
except
binascii
.
Error
:
# Incorrect padding
return
payload
elif
cte
in
(
'x-uuencode'
,
'uuencode'
,
'uue'
,
'x-uue'
):
sfp
=
StringIO
()
try
:
uu
.
decode
(
StringIO
(
payload
+
'
\n
'
),
sfp
)
payload
=
sfp
.
getvalue
()
except
uu
.
Error
:
# Some decoding problem
return
payload
# Everything else, including encodings with 8bit or 7bit are returned
# unchanged.
return
payload
...
...
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