XOAUTH2: correctly strip values for evaluated credentials

Don't use lambda anymore as default value.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-08-14 23:22:35 +02:00
parent 13043b5877
commit 9c386154bb

View File

@ -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):