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
45b2f889
Kaydet (Commit)
45b2f889
authored
May 14, 2019
tarafından
Jens Troeger
Kaydeden (comit)
R. David Murray
May 14, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34424: Handle different policy.linesep lengths correctly. (#8803)
üst
8da5ebe1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
_header_value_parser.py
Lib/email/_header_value_parser.py
+1
-1
test_generator.py
Lib/test/test_email/test_generator.py
+22
-0
2018-08-18-14-47-00.bpo-34424.wAlRuS.rst
...S.d/next/Library/2018-08-18-14-47-00.bpo-34424.wAlRuS.rst
+2
-0
No files found.
Lib/email/_header_value_parser.py
Dosyayı görüntüle @
45b2f889
...
...
@@ -2625,7 +2625,7 @@ def _refold_parse_tree(parse_tree, *, policy):
want_encoding
=
False
last_ew
=
None
if
part
.
syntactic_break
:
encoded_part
=
part
.
fold
(
policy
=
policy
)[:
-
1
]
# strip nl
encoded_part
=
part
.
fold
(
policy
=
policy
)[:
-
len
(
policy
.
linesep
)]
if
policy
.
linesep
not
in
encoded_part
:
# It fits on a single line
if
len
(
encoded_part
)
>
maxlen
-
len
(
lines
[
-
1
]):
...
...
Lib/test/test_email/test_generator.py
Dosyayı görüntüle @
45b2f889
...
...
@@ -4,6 +4,7 @@ import unittest
from
email
import
message_from_string
,
message_from_bytes
from
email.message
import
EmailMessage
from
email.generator
import
Generator
,
BytesGenerator
from
email.headerregistry
import
Address
from
email
import
policy
from
test.test_email
import
TestEmailBase
,
parameterize
...
...
@@ -291,6 +292,27 @@ class TestBytesGenerator(TestGeneratorBase, TestEmailBase):
g
.
flatten
(
msg
)
self
.
assertEqual
(
s
.
getvalue
(),
expected
)
def
test_smtp_policy
(
self
):
msg
=
EmailMessage
()
msg
[
"From"
]
=
Address
(
addr_spec
=
"foo@bar.com"
,
display_name
=
"Páolo"
)
msg
[
"To"
]
=
Address
(
addr_spec
=
"bar@foo.com"
,
display_name
=
"Dinsdale"
)
msg
[
"Subject"
]
=
"Nudge nudge, wink, wink"
msg
.
set_content
(
"oh boy, know what I mean, know what I mean?"
)
expected
=
textwrap
.
dedent
(
"""
\
From: =?utf-8?q?P=C3=A1olo?= <foo@bar.com>
To: Dinsdale <bar@foo.com>
Subject: Nudge nudge, wink, wink
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
oh boy, know what I mean, know what I mean?
"""
)
.
encode
()
.
replace
(
b
"
\n
"
,
b
"
\r\n
"
)
s
=
io
.
BytesIO
()
g
=
BytesGenerator
(
s
,
policy
=
policy
.
SMTP
)
g
.
flatten
(
msg
)
self
.
assertEqual
(
s
.
getvalue
(),
expected
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Misc/NEWS.d/next/Library/2018-08-18-14-47-00.bpo-34424.wAlRuS.rst
0 → 100644
Dosyayı görüntüle @
45b2f889
Fix serialization of messages containing encoded strings when the
policy.linesep is set to a multi-character string. Patch by Jens Troeger.
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