minor: fix indentation
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
d0cb96781c
commit
cb6790b804
@ -56,7 +56,8 @@ class LocalStatusSQLiteFolder(BaseFolder):
|
|||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname):
|
||||||
os.makedirs(dirname)
|
os.makedirs(dirname)
|
||||||
if not os.path.isdir(dirname):
|
if not os.path.isdir(dirname):
|
||||||
raise UserWarning("SQLite database path '%s' is not a directory." % dirname)
|
raise UserWarning("SQLite database path '%s' is not a directory."%
|
||||||
|
dirname)
|
||||||
|
|
||||||
# dblock protects against concurrent writes in same connection
|
# dblock protects against concurrent writes in same connection
|
||||||
self._dblock = Lock()
|
self._dblock = Lock()
|
||||||
@ -67,14 +68,15 @@ class LocalStatusSQLiteFolder(BaseFolder):
|
|||||||
except NameError:
|
except NameError:
|
||||||
# sqlite import had failed
|
# sqlite import had failed
|
||||||
raise UserWarning('SQLite backend chosen, but no sqlite python '
|
raise UserWarning('SQLite backend chosen, but no sqlite python '
|
||||||
'bindings available. Please install.'), None, exc_info()[2]
|
'bindings available. Please install.'), None, exc_info()[2]
|
||||||
|
|
||||||
#Make sure sqlite is in multithreading SERIALIZE mode
|
#Make sure sqlite is in multithreading SERIALIZE mode
|
||||||
assert sqlite.threadsafety == 1, 'Your sqlite is not multithreading safe.'
|
assert sqlite.threadsafety == 1, 'Your sqlite is not multithreading safe.'
|
||||||
|
|
||||||
#Test if db version is current enough and if db is readable.
|
#Test if db version is current enough and if db is readable.
|
||||||
try:
|
try:
|
||||||
cursor = self.connection.execute("SELECT value from metadata WHERE key='db_version'")
|
cursor = self.connection.execute(
|
||||||
|
"SELECT value from metadata WHERE key='db_version'")
|
||||||
except sqlite.DatabaseError:
|
except sqlite.DatabaseError:
|
||||||
#db file missing or corrupt, recreate it.
|
#db file missing or corrupt, recreate it.
|
||||||
self.__create_db()
|
self.__create_db()
|
||||||
|
@ -44,13 +44,13 @@ class Repository(object):
|
|||||||
name = account.getconf('remoterepository')
|
name = account.getconf('remoterepository')
|
||||||
# We don't support Maildirs on the remote side.
|
# We don't support Maildirs on the remote side.
|
||||||
typemap = {'IMAP': IMAPRepository,
|
typemap = {'IMAP': IMAPRepository,
|
||||||
'Gmail': GmailRepository}
|
'Gmail': GmailRepository}
|
||||||
|
|
||||||
elif reqtype == 'local':
|
elif reqtype == 'local':
|
||||||
name = account.getconf('localrepository')
|
name = account.getconf('localrepository')
|
||||||
typemap = {'IMAP': MappedIMAPRepository,
|
typemap = {'IMAP': MappedIMAPRepository,
|
||||||
'Maildir': MaildirRepository,
|
'Maildir': MaildirRepository,
|
||||||
'GmailMaildir': GmailMaildirRepository}
|
'GmailMaildir': GmailMaildirRepository}
|
||||||
|
|
||||||
elif reqtype == 'status':
|
elif reqtype == 'status':
|
||||||
# create and return a LocalStatusRepository
|
# create and return a LocalStatusRepository
|
||||||
@ -69,7 +69,7 @@ class Repository(object):
|
|||||||
errstr = ("Could not find section '%s' in configuration. Required "
|
errstr = ("Could not find section '%s' in configuration. Required "
|
||||||
"for account '%s'." % ('Repository %s' % name, account))
|
"for account '%s'." % ('Repository %s' % name, account))
|
||||||
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
|
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
|
||||||
None, exc_info()[2]
|
None, exc_info()[2]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
repo = typemap[repostype]
|
repo = typemap[repostype]
|
||||||
@ -77,7 +77,7 @@ class Repository(object):
|
|||||||
errstr = "'%s' repository not supported for '%s' repositories." \
|
errstr = "'%s' repository not supported for '%s' repositories." \
|
||||||
% (repostype, reqtype)
|
% (repostype, reqtype)
|
||||||
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
|
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
|
||||||
None, exc_info()[2]
|
None, exc_info()[2]
|
||||||
|
|
||||||
return repo(name, account)
|
return repo(name, account)
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ class UIBase(object):
|
|||||||
abortsleep = False
|
abortsleep = False
|
||||||
while sleepsecs > 0 and not abortsleep:
|
while sleepsecs > 0 and not abortsleep:
|
||||||
if account.get_abort_event():
|
if account.get_abort_event():
|
||||||
abortsleep = True
|
abortsleep = True
|
||||||
else:
|
else:
|
||||||
abortsleep = self.sleeping(10, sleepsecs)
|
abortsleep = self.sleeping(10, sleepsecs)
|
||||||
sleepsecs -= 10
|
sleepsecs -= 10
|
||||||
|
Loading…
Reference in New Issue
Block a user