[PATCH] repository: Base: apply local->remote nametrans after sep-conversion

Andrej Rode mail at andrejro.de
Sat Dec 24 19:15:58 GMT 2016


Allow usage of nametrans to sync remote folders with local sep in their
name.

Signed-off-by: Andrej Rode <mail at andrejro.de>
---
 offlineimap/accounts.py        | 14 +++++++-------
 offlineimap/repository/Base.py |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py
index 327af8b..3e114e8 100644
--- a/offlineimap/accounts.py
+++ b/offlineimap/accounts.py
@@ -361,13 +361,13 @@ class SyncableAccount(Account):
                 # their names since this would cause troubles while
converting
                 # the name back (from local to remote).
                 sep = localrepos.getsep()
-                if (sep != os.path.sep and
-                    sep != remoterepos.getsep() and
-                    sep in remotefolder.getname()):
-                    self.ui.warn('', "Ignoring folder '%s' due to
unsupported "
-                        "'%s' character serving as local separator."%
-                        (remotefolder.getname(), localrepos.getsep()))
-                    continue # Ignore unsupported folder name.
+                # if (sep != os.path.sep and
+                #     sep != remoterepos.getsep() and
+                #     sep in remotefolder.getname()):
+                #     self.ui.warn('', "Ignoring folder '%s' due to
unsupported "
+                #         "'%s' character serving as local separator."%
+                #         (remotefolder.getname(), localrepos.getsep()))
+                #     continue # Ignore unsupported folder name.
                  localfolder = self.get_local_folder(remotefolder)
                 if not localfolder.sync_this:
diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py
index 0c3d16f..a38c111 100644
--- a/offlineimap/repository/Base.py
+++ b/offlineimap/repository/Base.py
@@ -219,8 +219,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
                 break
              # Apply reverse nametrans and fix serparator.
-            remote_name = local_folder.getvisiblename().replace(
-                local_repo.getsep(), remote_repo.getsep())
+            remote_name =
local_folder.getrepository().nametrans(local_folder.getname().replace(
+                local_repo.getsep(), remote_repo.getsep()))
             if local_folder.sync_this and not remote_name in
remote_hash.keys():
                 # Would the remote filter out the new folder name? In
this case
                 # don't create it.
-- 
2.7.3





More information about the OfflineIMAP-project mailing list