make XOAUTH2 configuration option optional

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2015-10-12 07:37:39 +02:00
parent 9d7edcc0f4
commit af640208e1
2 changed files with 8 additions and 11 deletions

View File

@ -56,12 +56,12 @@ class GmailRepository(IMAPRepository):
Gmail implementation first checks for the usual IMAP settings
and falls back to imap.gmail.com if not specified."""
try:
return super(GmailRepository, self).getoauth2_request_url()
except OfflineImapError:
# nothing was configured, cache and return hardcoded one
url = super(GmailRepository, self).getoauth2_request_url()
if url is None:
# Nothing was configured, cache and return hardcoded one.
self._oauth2_request_url = GmailRepository.OAUTH2_URL
return self._oauth2_request_url
return self._oauth2_request_url
def getport(self):
return GmailRepository.PORT