Rename folder.isuidvalidityok()
Use nicer name folder.check_uidvalidity() and improve code documentation Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
297a618441
commit
eb616da602
@ -398,16 +398,17 @@ def syncfolder(account, remotefolder, quick):
|
|||||||
localfolder.cachemessagelist()
|
localfolder.cachemessagelist()
|
||||||
ui.messagelistloaded(localrepos, localfolder, localfolder.getmessagecount())
|
ui.messagelistloaded(localrepos, localfolder, localfolder.getmessagecount())
|
||||||
|
|
||||||
# If either the local or the status folder has messages and there is a UID
|
# If either the local or the status folder has messages and
|
||||||
# validity problem, warn and abort. If there are no messages, UW IMAPd
|
# there is a UID validity problem, warn and abort. If there are
|
||||||
# loses UIDVALIDITY. But we don't really need it if both local folders are
|
# no messages, UW IMAPd loses UIDVALIDITY. But we don't really
|
||||||
# empty. So, in that case, just save it off.
|
# need it if both local folders are empty. So, in that case,
|
||||||
|
# just save it off.
|
||||||
if localfolder.getmessagecount() or statusfolder.getmessagecount():
|
if localfolder.getmessagecount() or statusfolder.getmessagecount():
|
||||||
if not localfolder.isuidvalidityok():
|
if not localfolder.check_uidvalidity():
|
||||||
ui.validityproblem(localfolder)
|
ui.validityproblem(localfolder)
|
||||||
localrepos.restore_atime()
|
localrepos.restore_atime()
|
||||||
return
|
return
|
||||||
if not remotefolder.isuidvalidityok():
|
if not remotefolder.check_uidvalidity():
|
||||||
ui.validityproblem(remotefolder)
|
ui.validityproblem(remotefolder)
|
||||||
localrepos.restore_atime()
|
localrepos.restore_atime()
|
||||||
return
|
return
|
||||||
|
@ -109,18 +109,21 @@ class BaseFolder(object):
|
|||||||
basename = re.sub('(^|\/)\.$','\\1dot', basename)
|
basename = re.sub('(^|\/)\.$','\\1dot', basename)
|
||||||
return basename
|
return basename
|
||||||
|
|
||||||
def isuidvalidityok(self):
|
def check_uidvalidity(self):
|
||||||
"""Tests if the cached UIDVALIDITY match the real current one
|
"""Tests if the cached UIDVALIDITY match the real current one
|
||||||
|
|
||||||
If required it saves the UIDVALIDITY value. In this case the
|
If required it saves the UIDVALIDITY value. In this case the
|
||||||
function is not threadsafe. So don't attempt to call it from
|
function is not threadsafe. So don't attempt to call it from
|
||||||
concurrent threads."""
|
concurrent threads.
|
||||||
|
|
||||||
|
:returns: Boolean indicating the match. Returns True in case it
|
||||||
|
implicitely saved the UIDVALIDITY."""
|
||||||
|
|
||||||
if self.get_saveduidvalidity() != None:
|
if self.get_saveduidvalidity() != None:
|
||||||
return self.get_saveduidvalidity() == self.get_uidvalidity()
|
return self.get_saveduidvalidity() == self.get_uidvalidity()
|
||||||
else:
|
else:
|
||||||
self.saveuidvalidity()
|
self.saveuidvalidity()
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
def _getuidfilename(self):
|
def _getuidfilename(self):
|
||||||
return os.path.join(self.repository.getuiddir(),
|
return os.path.join(self.repository.getuiddir(),
|
||||||
|
Loading…
Reference in New Issue
Block a user