Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
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
django
Commits
dd001848
Kaydet (Commit)
dd001848
authored
Nis 07, 2017
tarafından
kalombo
Kaydeden (comit)
Tim Graham
Nis 07, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's attachments arg.
üst
aedfe0dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
message.py
django/core/mail/message.py
+7
-1
1.11.1.txt
docs/releases/1.11.1.txt
+3
-0
tests.py
tests/mail/tests.py
+7
-0
No files found.
django/core/mail/message.py
Dosyayı görüntüle @
dd001848
...
...
@@ -236,7 +236,13 @@ class EmailMessage:
self
.
from_email
=
from_email
or
settings
.
DEFAULT_FROM_EMAIL
self
.
subject
=
subject
self
.
body
=
body
self
.
attachments
=
attachments
or
[]
self
.
attachments
=
[]
if
attachments
:
for
attachment
in
attachments
:
if
isinstance
(
attachment
,
MIMEBase
):
self
.
attach
(
attachment
)
else
:
self
.
attach
(
*
attachment
)
self
.
extra_headers
=
headers
or
{}
self
.
connection
=
connection
...
...
docs/releases/1.11.1.txt
Dosyayı görüntüle @
dd001848
...
...
@@ -15,3 +15,6 @@ Bugfixes
* Fixed a crash when using a ``__icontains`` lookup on a ``ArrayField``
(:ticket:`28038`).
* Fixed a crash when using a two-tuple in ``EmailMessage``’s ``attachments``
argument (:ticket:`28042`).
tests/mail/tests.py
Dosyayı görüntüle @
dd001848
...
...
@@ -374,6 +374,13 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
self
.
assertEqual
(
payload
[
0
]
.
get_content_type
(),
'multipart/alternative'
)
self
.
assertEqual
(
payload
[
1
]
.
get_content_type
(),
'application/pdf'
)
def
test_attachments_two_tuple
(
self
):
msg
=
EmailMessage
(
attachments
=
[(
'filename1'
,
'content1'
)])
filename
,
content
,
mimetype
=
self
.
get_decoded_attachments
(
msg
)[
0
]
self
.
assertEqual
(
filename
,
'filename1'
)
self
.
assertEqual
(
content
,
b
'content1'
)
self
.
assertEqual
(
mimetype
,
'application/octet-stream'
)
def
test_attachments_MIMEText
(
self
):
txt
=
MIMEText
(
'content1'
)
msg
=
EmailMessage
(
attachments
=
[
txt
])
...
...
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