Create an abstract Repository class
A Repository() returns the correctly instanciated dervivate of a BaseRepository, depending on the parameters passed to it. The returned instance is eg an ImapRepository(). This makes the code look nicer, and we have less functions lying around outside of classes (no more global LoadRepository() function). This will also enable us to conveniently hand back a LocalStatusRepository based on SQLITE rather than plain text, if the user configures this to be the experimental and optional backend (once it exists). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:

committed by
Nicolas Sebrecht

parent
d05162675c
commit
d5e7620ce9
@ -16,7 +16,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from offlineimap import threadutil, mbnames, CustomConfig
|
||||
import offlineimap.repository.Base, offlineimap.repository.LocalStatus
|
||||
from offlineimap.repository import Repository
|
||||
from offlineimap.ui import getglobalui
|
||||
from offlineimap.threadutil import InstanceLimitedThread, ExitNotifyThread
|
||||
from subprocess import Popen, PIPE
|
||||
@ -175,13 +175,10 @@ class AccountSynchronizationMixin:
|
||||
if not os.path.exists(accountmetadata):
|
||||
os.mkdir(accountmetadata, 0700)
|
||||
|
||||
self.remoterepos = offlineimap.repository.Base.LoadRepository(self.getconf('remoterepository'), self, 'remote')
|
||||
|
||||
# Connect to the local repository.
|
||||
self.localrepos = offlineimap.repository.Base.LoadRepository(self.getconf('localrepository'), self, 'local')
|
||||
|
||||
# Connect to the local cache.
|
||||
self.statusrepos = offlineimap.repository.LocalStatus.LocalStatusRepository(self.getconf('localrepository'), self)
|
||||
# get all three repositories
|
||||
self.remoterepos = Repository(self, 'remote')
|
||||
self.localrepos = Repository(self, 'local')
|
||||
self.statusrepos = Repository(self, 'status')
|
||||
|
||||
#might need changes here to ensure that one account sync does not crash others...
|
||||
if not self.refreshperiod:
|
||||
|
Reference in New Issue
Block a user