From 8c441158070194b53a416a574e4856709c732c60 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 1 Dec 2011 10:27:12 +0100 Subject: [PATCH] Init folder list early enough We need the list of folders and the folder delimiter, but it was not always retrieved early enough. E.g. when doing IMAP<->IMAP sync and the local IMAP being readonly, we would bunk out with a mysterious error message become repository.getsel() would still return None. This commit fixes this error. Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 5 +++++ offlineimap/accounts.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 76a0ea3..d9aa0bf 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -18,3 +18,8 @@ Changes Bug Fixes --------- + +* IMAP<->IMAP sync with a readonly local IMAP repository failed with a + rather mysterious "TypeError: expected a character buffer object" + error. Fix this my retrieving the list of folders early enough even + for readonly repositories. diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 71f08fe..d476b3e 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -265,6 +265,13 @@ class SyncableAccount(Account): remoterepos = self.remoterepos localrepos = self.localrepos statusrepos = self.statusrepos + + # init repos with list of folders, so we have them (and the + # folder delimiter etc) + remoterepos.getfolders() + localrepos.getfolders() + statusrepos.getfolders() + # replicate the folderstructure between REMOTE to LOCAL if not localrepos.getconfboolean('readonly', False): self.ui.syncfolders(remoterepos, localrepos)