diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 0e1ea6e..f7651f2 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -309,32 +309,40 @@ class IMAPRepository(BaseRepository): refresh_token = self.getconf('oauth2_refresh_token', None) if refresh_token is None: refresh_token = self.localeval.eval( - self.getconf('oauth2_refresh_token_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_refresh_token_eval', "None") + ) + if refresh_token is not None: + refresh_token = refresh_token.strip("\n") return refresh_token def getoauth2_access_token(self): access_token = self.getconf('oauth2_access_token', None) if access_token is None: access_token = self.localeval.eval( - self.getconf('oauth2_access_token_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_access_token_eval', "None") + ) + if access_token is not None: + access_token = access_token.strip("\n") return access_token def getoauth2_client_id(self): client_id = self.getconf('oauth2_client_id', None) if client_id is None: client_id = self.localeval.eval( - self.getconf('oauth2_client_id_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_client_id_eval', "None") + ) + if client_id is not None: + client_id = client_id.strip("\n") return client_id def getoauth2_client_secret(self): client_secret = self.getconf('oauth2_client_secret', None) if client_secret is None: client_secret = self.localeval.eval( - self.getconf('oauth2_client_secret_eval', "lambda: None") - ).strip("\n") + self.getconf('oauth2_client_secret_eval', "None") + ) + if client_secret is not None: + client_secret = client_secret.strip("\n") return client_secret def getpreauthtunnel(self):