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
08041d58
Kaydet (Commit)
08041d58
authored
May 04, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update checks to consider Windows error numbers.
üst
4fc2bda8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
mailbox.py
Lib/mailbox.py
+29
-3
No files found.
Lib/mailbox.py
Dosyayı görüntüle @
08041d58
...
...
@@ -2,6 +2,7 @@
"""Read/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes."""
import
sys
import
os
import
time
import
calendar
...
...
@@ -23,6 +24,11 @@ __all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF',
'BabylMessage'
,
'MMDFMessage'
,
'UnixMailbox'
,
'PortableUnixMailbox'
,
'MmdfMailbox'
,
'MHMailbox'
,
'BabylMailbox'
]
if
sys
.
platform
!=
'win32'
:
# Define WindowsError so that we can use it in an except statement
# even on non-Windows systems
class
WindowsError
:
pass
class
Mailbox
:
"""A group of messages in a particular place."""
...
...
@@ -262,10 +268,11 @@ class Maildir(Mailbox):
self
.
remove
(
key
)
except
KeyError
:
pass
except
WindowsError
,
e
:
if
e
.
errno
!=
2
:
# ERROR_FILE_NOT_FOUND
raise
except
OSError
,
e
:
if
e
.
errno
==
errno
.
ENOENT
:
pass
else
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
def
__setitem__
(
self
,
key
,
message
):
...
...
@@ -419,6 +426,12 @@ class Maildir(Mailbox):
path
=
os
.
path
.
join
(
self
.
_path
,
'tmp'
,
uniq
)
try
:
os
.
stat
(
path
)
except
WindowsError
,
e
:
if
e
.
errno
==
2
:
# ERROR_FILE_NOT_FOUND
Maildir
.
_count
+=
1
return
open
(
path
,
'wb+'
)
else
:
raise
except
OSError
,
e
:
if
e
.
errno
==
errno
.
ENOENT
:
Maildir
.
_count
+=
1
...
...
@@ -566,6 +579,12 @@ class _singlefileMailbox(Mailbox):
self
.
_file
.
close
()
try
:
os
.
rename
(
new_file
.
name
,
self
.
_path
)
except
WindowsError
,
e
:
if
e
.
errno
==
183
:
# ERROR_ALREADY_EXISTS
os
.
remove
(
self
.
_path
)
os
.
rename
(
new_file
.
name
,
self
.
_path
)
else
:
raise
except
OSError
,
e
:
if
e
.
errno
==
errno
.
EEXIST
:
os
.
remove
(
self
.
_path
)
...
...
@@ -1837,6 +1856,13 @@ def _lock_file(f, dotlock=True):
else
:
os
.
rename
(
pre_lock
.
name
,
f
.
name
+
'.lock'
)
dotlock_done
=
True
except
WindowsError
,
e
:
if
e
.
errno
==
183
:
# ERROR_ALREADY_EXISTS
os
.
remove
(
pre_lock
.
name
)
raise
ExternalClashError
(
'dot lock unavailable:
%
s'
%
f
.
name
)
else
:
raise
except
OSError
,
e
:
if
e
.
errno
==
errno
.
EEXIST
:
os
.
remove
(
pre_lock
.
name
)
...
...
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