more style consistency

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2015-01-14 22:58:25 +01:00
parent 5318af606e
commit 461554b7b1
20 changed files with 343 additions and 297 deletions

View File

@@ -78,7 +78,7 @@ class MappedIMAPFolder(IMAPFolder):
try:
file = open(mapfilename + ".tmp", 'wt')
for (key, value) in self.diskl2r.iteritems():
file.write("%d:%d\n" % (key, value))
file.write("%d:%d\n"% (key, value))
file.close()
os.rename(mapfilename + '.tmp', mapfilename)
finally:
@@ -91,7 +91,7 @@ class MappedIMAPFolder(IMAPFolder):
raise OfflineImapError("Could not find UID for msg '{0}' (f:'{1}'."
" This is usually a bad thing and should be reported on the ma"
"iling list.".format(e.args[0], self),
OfflineImapError.ERROR.MESSAGE), None, exc_info()[2]
OfflineImapError.ERROR.MESSAGE), None, exc_info()[2]
# Interface from BaseFolder
def cachemessagelist(self):
@@ -215,8 +215,8 @@ class MappedIMAPFolder(IMAPFolder):
newluid = self._mb.savemessage(-1, content, flags, rtime)
if newluid < 1:
raise ValueError("Backend could not find uid for message, returned "
"%s" % newluid)
raise ValueError("Backend could not find uid for message, "
"returned %s"% newluid)
self.maplock.acquire()
try:
self.diskl2r[newluid] = uid
@@ -262,8 +262,8 @@ class MappedIMAPFolder(IMAPFolder):
UID. The UIDMaps case handles this efficiently by simply
changing the mappings file."""
if ruid not in self.r2l:
raise OfflineImapError("Cannot change unknown Maildir UID %s" % ruid,
OfflineImapError.ERROR.MESSAGE)
raise OfflineImapError("Cannot change unknown Maildir UID %s"%
ruid, OfflineImapError.ERROR.MESSAGE)
if ruid == new_ruid: return # sanity check shortcut
self.maplock.acquire()
try:
@@ -271,10 +271,10 @@ class MappedIMAPFolder(IMAPFolder):
self.l2r[luid] = new_ruid
del self.r2l[ruid]
self.r2l[new_ruid] = luid
#TODO: diskl2r|r2l are a pain to sync and should be done away with
#diskl2r only contains positive UIDs, so wrap in ifs
if luid>0: self.diskl2r[luid] = new_ruid
if ruid>0: del self.diskr2l[ruid]
# TODO: diskl2r|r2l are a pain to sync and should be done away with
# diskl2r only contains positive UIDs, so wrap in ifs.
if luid > 0: self.diskl2r[luid] = new_ruid
if ruid > 0: del self.diskr2l[ruid]
if new_ruid > 0: self.diskr2l[new_ruid] = luid
self._savemaps(dolock = 0)
finally: