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
e58df829
Kaydet (Commit)
e58df829
authored
Şub 08, 2006
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Port relevant patches for SF 1409455 to the trunk for email 3.0/Python 2.5.
Will port to Python 2.4.
üst
a871ef2b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
8 deletions
+20
-8
Charset.py
Lib/email/Charset.py
+2
-2
Generator.py
Lib/email/Generator.py
+1
-4
Message.py
Lib/email/Message.py
+3
-0
test_email.py
Lib/email/test/test_email.py
+2
-1
test_email_codecs.py
Lib/email/test/test_email_codecs.py
+12
-1
No files found.
Lib/email/Charset.py
Dosyayı görüntüle @
e58df829
# Copyright (C) 2001-200
4
Python Software Foundation
# Copyright (C) 2001-200
6
Python Software Foundation
# Author: Ben Gertzfield, Barry Warsaw
# Contact: email-sig@python.org
...
...
@@ -206,7 +206,7 @@ class Charset:
self
.
input_codec
=
CODEC_MAP
.
get
(
self
.
input_charset
,
self
.
input_charset
)
self
.
output_codec
=
CODEC_MAP
.
get
(
self
.
output_charset
,
self
.
output_charset
)
self
.
output_charset
)
def
__str__
(
self
):
return
self
.
input_charset
.
lower
()
...
...
Lib/email/Generator.py
Dosyayı görüntüle @
e58df829
# Copyright (C) 2001-200
4
Python Software Foundation
# Copyright (C) 2001-200
6
Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
...
...
@@ -175,9 +175,6 @@ class Generator:
payload
=
msg
.
get_payload
()
if
payload
is
None
:
return
cset
=
msg
.
get_charset
()
if
cset
is
not
None
:
payload
=
cset
.
body_encode
(
payload
)
if
not
isinstance
(
payload
,
basestring
):
raise
TypeError
(
'string payload expected:
%
s'
%
type
(
payload
))
if
self
.
_mangle_from_
:
...
...
Lib/email/Message.py
Dosyayı görüntüle @
e58df829
...
...
@@ -250,11 +250,14 @@ class Message:
charset
=
charset
.
get_output_charset
())
else
:
self
.
set_param
(
'charset'
,
charset
.
get_output_charset
())
if
str
(
charset
)
<>
charset
.
get_output_charset
():
self
.
_payload
=
charset
.
body_encode
(
self
.
_payload
)
if
not
self
.
has_key
(
'Content-Transfer-Encoding'
):
cte
=
charset
.
get_body_encoding
()
try
:
cte
(
self
)
except
TypeError
:
self
.
_payload
=
charset
.
body_encode
(
self
.
_payload
)
self
.
add_header
(
'Content-Transfer-Encoding'
,
cte
)
def
get_charset
(
self
):
...
...
Lib/email/test/test_email.py
Dosyayı görüntüle @
e58df829
...
...
@@ -2221,7 +2221,8 @@ class TestMiscellaneous(TestEmailBase):
charset
=
Charset
(
charsets
[
0
])
eq
(
charset
.
get_body_encoding
(),
'base64'
)
msg
.
set_payload
(
'hello world'
,
charset
=
charset
)
eq
(
msg
.
get_payload
(),
'hello world'
)
eq
(
msg
.
get_payload
(),
'aGVsbG8gd29ybGQ=
\n
'
)
eq
(
msg
.
get_payload
(
decode
=
True
),
'hello world'
)
eq
(
msg
[
'content-transfer-encoding'
],
'base64'
)
# Try another one
msg
=
Message
()
...
...
Lib/email/test/test_email_codecs.py
Dosyayı görüntüle @
e58df829
# Copyright (C) 2002 Python Software Foundation
# Copyright (C) 2002-2006 Python Software Foundation
# Contact: email-sig@python.org
# email package unit tests for (optional) Asian codecs
import
unittest
...
...
@@ -7,6 +8,8 @@ from test.test_support import TestSkipped, run_unittest
from
email.test.test_email
import
TestEmailBase
from
email.Charset
import
Charset
from
email.Header
import
Header
,
decode_header
from
email.Message
import
Message
class
TestEmailAsianCodecs
(
TestEmailBase
):
...
...
@@ -42,6 +45,14 @@ Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=
# TK: full decode comparison
eq
(
h
.
__unicode__
()
.
encode
(
'euc-jp'
),
long
)
def
test_payload_encoding
(
self
):
jhello
=
'
\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa
'
jcode
=
'euc-jp'
msg
=
Message
()
msg
.
set_payload
(
jhello
,
jcode
)
ustr
=
unicode
(
msg
.
get_payload
(),
msg
.
get_content_charset
())
self
.
assertEqual
(
jhello
,
ustr
.
encode
(
jcode
))
def
suite
():
...
...
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