remove support for the status_backend configuration option

Stop the run when this option is found. Migrating from the historical plain
text status cache is still supported.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2017-03-25 13:12:11 +01:00
parent 49c6f14ce4
commit c8206f24e1
3 changed files with 14 additions and 20 deletions

View File

@ -20,31 +20,37 @@ import os
from offlineimap.folder.LocalStatus import LocalStatusFolder
from offlineimap.folder.LocalStatusSQLite import LocalStatusSQLiteFolder
from offlineimap.repository.Base import BaseRepository
from offlineimap.error import OfflineImapError
class LocalStatusRepository(BaseRepository):
def __init__(self, reposname, account):
BaseRepository.__init__(self, reposname, account)
# class and root for all backends
# class and root for all backends.
self.backends = {}
self.backends['sqlite'] = {
'class': LocalStatusSQLiteFolder,
'root': os.path.join(account.getaccountmeta(), 'LocalStatus-sqlite')
}
self.backends['plain'] = {
'class': LocalStatusFolder,
'root': os.path.join(account.getaccountmeta(), 'LocalStatus')
}
# Set class and root for the configured backend
self.setup_backend(self.account.getconf('status_backend', 'sqlite'))
if self.account.getconf('status_backend', None) is not None:
raise OfflineImapError(
"the 'status_backend' configuration option is not supported"
" anymore; please, remove this configuration option.",
OfflineImapError.ERROR.REPO
)
# Set class and root for sqlite.
self.setup_backend('sqlite')
if not os.path.exists(self.root):
os.mkdir(self.root, 0o700)
# self._folders is a dict of name:LocalStatusFolders()
# self._folders is a dict of name:LocalStatusFolders().
self._folders = {}
def _instanciatefolder(self, foldername):
@ -56,10 +62,6 @@ class LocalStatusRepository(BaseRepository):
self.root = self.backends[backend]['root']
self.LocalStatusFolderClass = self.backends[backend]['class']
else:
raise SyntaxWarning("Unknown status_backend '%s' for account '%s'"%
(backend, self.account.name))
def import_other_backend(self, folder):
for bk, dic in self.backends.items():
# Skip folder's own type.