repository: Simplify restore_atime code

repository.BaseRepository().restore_atime() was testing in complex ways
that it only operates on a Maildir and that the 'restoreatime' setting
is set. This is unecessary, we can simply make the base implementation a
NoOp, and move the implementation to MaildirRepository().

This will save a tad of work for everyone doing IMAP<->IMAP
synchronization and simplify the code. Also document the functions.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth
2011-09-15 15:06:30 +02:00
committed by Nicolas Sebrecht
parent d2af21d57d
commit c1a2b1559d
2 changed files with 12 additions and 12 deletions

View File

@ -39,17 +39,13 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
if not os.path.exists(self.uiddir):
os.mkdir(self.uiddir, 0700)
# The 'restoreatime' config parameter only applies to local Maildir
# mailboxes.
def restore_atime(self):
if self.config.get('Repository ' + self.name, 'type').strip() != \
'Maildir':
return
"""Sets folders' atime back to their values after a sync
if not self.config.has_option('Repository ' + self.name, 'restoreatime') or not self.config.getboolean('Repository ' + self.name, 'restoreatime'):
return
return self.restore_folder_atimes()
Controlled by the 'restoreatime' config parameter (default
False), applies only to local Maildir mailboxes and does nothing
on all other repository types."""
pass
def connect(self):
"""Establish a connection to the remote, if necessary. This exists