From a629b4e0e72156413b88807022497e27ea6d1c3f Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sat, 31 May 2014 10:42:25 -0400 Subject: [PATCH] do not error if `remoteuser` is not configured Signed-off-by: Mark Oteiza Signed-off-by: Nicolas Sebrecht --- offlineimap/repository/IMAP.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index ff1d5e2..430c6dc 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -156,7 +156,8 @@ class IMAPRepository(BaseRepository): if user != None: return localeval.eval(user) - user = self.getconf('remoteuser') + if self.config.has_option(self.getsection(), 'remoteuser'): + user = self.getconf('remoteuser') if user != None: return user @@ -284,7 +285,7 @@ class IMAPRepository(BaseRepository): raise else: if netrcentry: - user = self.getconf('remoteuser') + user = self.getuser() if user == None or user == netrcentry[0]: return netrcentry[2] # 5. read password from /etc/netrc @@ -295,7 +296,7 @@ class IMAPRepository(BaseRepository): raise else: if netrcentry: - user = self.getconf('remoteuser') + user = self.getuser() if user == None or user == netrcentry[0]: return netrcentry[2] # no strategy yielded a password!