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
ea72dcb0
Kaydet (Commit)
ea72dcb0
authored
Ock 19, 2008
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
üst
5f4fc831
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
mailbox.py
Lib/mailbox.py
+4
-1
test_mailbox.py
Lib/test/test_mailbox.py
+14
-0
No files found.
Lib/mailbox.py
Dosyayı görüntüle @
ea72dcb0
...
...
@@ -315,7 +315,10 @@ class Maildir(Mailbox):
subpath
=
self
.
_lookup
(
key
)
f
=
open
(
os
.
path
.
join
(
self
.
_path
,
subpath
),
'r'
)
try
:
msg
=
MaildirMessage
(
f
)
if
self
.
_factory
:
msg
=
self
.
_factory
(
f
)
else
:
msg
=
MaildirMessage
(
f
)
finally
:
f
.
close
()
subdir
,
name
=
os
.
path
.
split
(
subpath
)
...
...
Lib/test/test_mailbox.py
Dosyayı görüntüle @
ea72dcb0
...
...
@@ -508,6 +508,20 @@ class TestMaildir(TestMailbox):
self
.
assert_
(
msg_returned
.
get_flags
()
==
'S'
)
self
.
assert_
(
msg_returned
.
get_payload
()
==
'3'
)
def
test_consistent_factory
(
self
):
# Add a message.
msg
=
mailbox
.
MaildirMessage
(
self
.
_template
%
0
)
msg
.
set_subdir
(
'cur'
)
msg
.
set_flags
(
'RF'
)
key
=
self
.
_box
.
add
(
msg
)
# Create new mailbox with
class
FakeMessage
(
mailbox
.
MaildirMessage
):
pass
box
=
mailbox
.
Maildir
(
self
.
_path
,
factory
=
FakeMessage
)
msg2
=
box
.
get_message
(
key
)
self
.
assert_
(
isinstance
(
msg2
,
FakeMessage
))
def
test_initialize_new
(
self
):
# Initialize a non-existent mailbox
self
.
tearDown
()
...
...
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