Base.py long lines style
This patch changes long lines (>80 chars) to lines <80 chars. The patch only changes the style.
This commit is contained in:
parent
332a6d7240
commit
23f67019cc
@ -34,7 +34,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
self.localeval = account.getlocaleval()
|
self.localeval = account.getlocaleval()
|
||||||
self._accountname = self.account.getname()
|
self._accountname = self.account.getname()
|
||||||
self._readonly = self.getconfboolean('readonly', False)
|
self._readonly = self.getconfboolean('readonly', False)
|
||||||
self.uiddir = os.path.join(self.config.getmetadatadir(), 'Repository-' + self.name)
|
self.uiddir = os.path.join(self.config.getmetadatadir(),
|
||||||
|
'Repository-' + self.name)
|
||||||
if not os.path.exists(self.uiddir):
|
if not os.path.exists(self.uiddir):
|
||||||
os.mkdir(self.uiddir, 0o700)
|
os.mkdir(self.uiddir, 0o700)
|
||||||
self.mapdir = os.path.join(self.uiddir, 'UIDMapping')
|
self.mapdir = os.path.join(self.uiddir, 'UIDMapping')
|
||||||
@ -154,7 +155,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
It is disabled by either setting the whole repository
|
It is disabled by either setting the whole repository
|
||||||
'readonly' or by using the 'createfolders' setting."""
|
'readonly' or by using the 'createfolders' setting."""
|
||||||
|
|
||||||
return (not self._readonly) and self.getconfboolean('createfolders', True)
|
return (not self._readonly) and self.getconfboolean('createfolders',
|
||||||
|
True)
|
||||||
|
|
||||||
def makefolder(self, foldername):
|
def makefolder(self, foldername):
|
||||||
"""Create a new folder."""
|
"""Create a new folder."""
|
||||||
@ -182,7 +184,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
Configuring nametrans on BOTH repositories could lead to infinite folder
|
Configuring nametrans on BOTH repositories could lead to infinite folder
|
||||||
creation cycles."""
|
creation cycles."""
|
||||||
|
|
||||||
if not self.should_create_folders() and not local_repo.should_create_folders():
|
if not self.should_create_folders()\
|
||||||
|
and not local_repo.should_create_folders():
|
||||||
# Quick exit if no folder creation is enabled on either side.
|
# Quick exit if no folder creation is enabled on either side.
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -204,7 +207,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
# Apply remote nametrans and fix serparator.
|
# Apply remote nametrans and fix serparator.
|
||||||
local_name = remote_folder.getvisiblename().replace(
|
local_name = remote_folder.getvisiblename().replace(
|
||||||
remote_repo.getsep(), local_repo.getsep())
|
remote_repo.getsep(), local_repo.getsep())
|
||||||
if remote_folder.sync_this and local_name not in list(local_hash.keys()):
|
if remote_folder.sync_this \
|
||||||
|
and local_name not in list(local_hash.keys()):
|
||||||
try:
|
try:
|
||||||
local_repo.makefolder(local_name)
|
local_repo.makefolder(local_name)
|
||||||
# Need to refresh list.
|
# Need to refresh list.
|
||||||
@ -226,13 +230,15 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
# Apply reverse nametrans and fix serparator.
|
# Apply reverse nametrans and fix serparator.
|
||||||
remote_name = local_folder.getvisiblename().replace(
|
remote_name = local_folder.getvisiblename().replace(
|
||||||
local_repo.getsep(), remote_repo.getsep())
|
local_repo.getsep(), remote_repo.getsep())
|
||||||
if local_folder.sync_this and remote_name not in list(remote_hash.keys()):
|
if local_folder.sync_this \
|
||||||
|
and remote_name not in list(remote_hash.keys()):
|
||||||
# Would the remote filter out the new folder name? In this case
|
# Would the remote filter out the new folder name? In this case
|
||||||
# don't create it.
|
# don't create it.
|
||||||
if not remote_repo.should_sync_folder(remote_name):
|
if not remote_repo.should_sync_folder(remote_name):
|
||||||
self.ui.debug('', "Not creating folder '%s' (repository '%s"
|
msg = "Not creating folder '%s' (repository '%s') " \
|
||||||
"') as it would be filtered out on that repository." %
|
"as it would be filtered out on that repository." % \
|
||||||
(remote_name, self))
|
(remote_name, self)
|
||||||
|
self.ui.debug('', msg)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# nametrans sanity check! Does remote nametrans lead to the
|
# nametrans sanity check! Does remote nametrans lead to the
|
||||||
@ -247,23 +253,25 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
# Get IMAPFolder and see if the reverse nametrans works fine.
|
# Get IMAPFolder and see if the reverse nametrans works fine.
|
||||||
# TODO: getfolder() works only because we succeed in getting
|
# TODO: getfolder() works only because we succeed in getting
|
||||||
# inexisting folders which I would like to change. Take care!
|
# inexisting folders which I would like to change. Take care!
|
||||||
tmp_remotefolder = remote_repo.getfolder(remote_name, decode=False)
|
tmp_remotefolder = remote_repo.getfolder(remote_name,
|
||||||
|
decode=False)
|
||||||
loop_name = tmp_remotefolder.getvisiblename().replace(
|
loop_name = tmp_remotefolder.getvisiblename().replace(
|
||||||
remote_repo.getsep(), local_repo.getsep())
|
remote_repo.getsep(), local_repo.getsep())
|
||||||
if local_name != loop_name:
|
if local_name != loop_name:
|
||||||
raise OfflineImapError("INFINITE FOLDER CREATION DETECTED! "
|
msg = "INFINITE FOLDER CREATION DETECTED! "\
|
||||||
"Folder '%s' (repository '%s') would be created as fold"
|
"Folder '%s' (repository '%s') would be created as " \
|
||||||
"er '%s' (repository '%s'). The latter becomes '%s' in "
|
"folder '%s' (repository '%s'). The latter " \
|
||||||
"return, leading to infinite folder creation cycles.\n "
|
"becomes '%s' in return, leading to infinite " \
|
||||||
"SOLUTION: 1) Do set your nametrans rules on both repos"
|
"folder creation cycles.\n "\
|
||||||
"itories so they lead to identical names if applied bac"
|
"SOLUTION: 1) Do set your nametrans rules on both " \
|
||||||
"k and forth. 2) Use folderfilter settings on a reposit"
|
"repositories so they lead to identical names if " \
|
||||||
"ory to prevent some folders from being created on the "
|
"applied back and forth. " \
|
||||||
"other side." %
|
"2) Use folderfilter settings on a repository to " \
|
||||||
(local_folder.getname(), local_repo, remote_name,
|
"prevent some folders from being created on the " \
|
||||||
remote_repo,
|
"other side." % \
|
||||||
loop_name),
|
(local_folder.getname(), local_repo, remote_name,
|
||||||
OfflineImapError.ERROR.REPO)
|
remote_repo, loop_name)
|
||||||
|
raise OfflineImapError(msg, OfflineImapError.ERROR.REPO)
|
||||||
|
|
||||||
# End sanity check, actually create the folder.
|
# End sanity check, actually create the folder.
|
||||||
try:
|
try:
|
||||||
@ -271,8 +279,9 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
# Need to refresh list.
|
# Need to refresh list.
|
||||||
self.forgetfolders()
|
self.forgetfolders()
|
||||||
except OfflineImapError as e:
|
except OfflineImapError as e:
|
||||||
self.ui.error(e, exc_info()[2], "Creating folder %s on "
|
msg = "Creating folder %s on repository %s" % \
|
||||||
"repository %s" % (remote_name, remote_repo))
|
(remote_name, remote_repo)
|
||||||
|
self.ui.error(e, exc_info()[2], msg)
|
||||||
raise
|
raise
|
||||||
status_repo.makefolder(local_name.replace(
|
status_repo.makefolder(local_name.replace(
|
||||||
local_repo.getsep(), status_repo.getsep()))
|
local_repo.getsep(), status_repo.getsep()))
|
||||||
|
Loading…
Reference in New Issue
Block a user