Prettify and use new uidexists() helper function
Make the folder classes use uidexists() more. Add some code documentation while going through. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
0318c6ad34
commit
f4081985dc
@ -562,7 +562,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
|
|
||||||
def deletemessages_noconvert(self, uidlist):
|
def deletemessages_noconvert(self, uidlist):
|
||||||
# Weed out ones not in self.messagelist
|
# Weed out ones not in self.messagelist
|
||||||
uidlist = [uid for uid in uidlist if uid in self.messagelist]
|
uidlist = [uid for uid in uidlist if self.uidexists(uid)]
|
||||||
if not len(uidlist):
|
if not len(uidlist):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -295,8 +295,16 @@ class MaildirFolder(BaseFolder):
|
|||||||
assert final_dir != tmpdir
|
assert final_dir != tmpdir
|
||||||
|
|
||||||
def deletemessage(self, uid):
|
def deletemessage(self, uid):
|
||||||
if not uid in self.messagelist:
|
"""Unlinks a message file from the Maildir.
|
||||||
|
|
||||||
|
:param uid: UID of a mail message
|
||||||
|
:type uid: String
|
||||||
|
:return: Nothing, or an Exception if UID but no corresponding file
|
||||||
|
found.
|
||||||
|
"""
|
||||||
|
if not self.uidexists(uid):
|
||||||
return
|
return
|
||||||
|
|
||||||
filename = self.messagelist[uid]['filename']
|
filename = self.messagelist[uid]['filename']
|
||||||
try:
|
try:
|
||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user