sync_folder_structure: make more readable

Rename variable src_name to src_name_t to indicate that it is the transposed
name. Also rather than testing the hash thingie, we can simply test for
"if source_name_t in dst_folders" now.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-02-16 11:12:07 +01:00
parent 10dd317026
commit 189d78cc5c

View File

@ -156,20 +156,20 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
dst_hash[folder.name] = folder dst_hash[folder.name] = folder
# Find new folders on src_repo. # Find new folders on src_repo.
for src_name, src_folder in src_hash.iteritems(): for src_name_t, src_folder in src_hash.iteritems():
# Don't create on dst_repo, if it is readonly # Don't create on dst_repo, if it is readonly
if dst_repo.getconfboolean('readonly', False): if dst_repo.getconfboolean('readonly', False):
break break
if src_folder.sync_this and not src_name in dst_hash: if src_folder.sync_this and not src_name_t in dst_folders:
try: try:
dst_repo.makefolder(src_name) dst_repo.makefolder(src_name_t)
dst_haschanged = True # Need to refresh list dst_haschanged = True # Need to refresh list
except OfflineImapError as e: except OfflineImapError as e:
self.ui.error(e, exc_info()[2], self.ui.error(e, exc_info()[2],
"Creating folder %s on repository %s" %\ "Creating folder %s on repository %s" %\
(src_name, dst_repo)) (src_name_t, dst_repo))
raise raise
status_repo.makefolder(src_name.replace(dst_repo.getsep(), status_repo.makefolder(src_name_t.replace(dst_repo.getsep(),
status_repo.getsep())) status_repo.getsep()))
# Find new folders on dst_repo. # Find new folders on dst_repo.
for dst_name, dst_folder in dst_hash.iteritems(): for dst_name, dst_folder in dst_hash.iteritems():