make XOAUTH2 configuration option optional
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
9d7edcc0f4
commit
af640208e1
@ -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
|
||||
|
@ -259,7 +259,7 @@ class IMAPRepository(BaseRepository):
|
||||
return [f.strip().lower() for f in value.split(',') if f]
|
||||
|
||||
def getoauth2_request_url(self):
|
||||
if self._oauth2_request_url: # use cached value if possible
|
||||
if self._oauth2_request_url: # Use cached value if possible.
|
||||
return self._oauth2_request_url
|
||||
|
||||
oauth2_request_url = self.getconf('oauth2_request_url', None)
|
||||
@ -267,11 +267,8 @@ class IMAPRepository(BaseRepository):
|
||||
self._oauth2_request_url = oauth2_request_url
|
||||
return self._oauth2_request_url
|
||||
|
||||
# no success
|
||||
raise OfflineImapError("No remote oauth2_request_url for repository "\
|
||||
"'%s' specified." % self,
|
||||
OfflineImapError.ERROR.REPO)
|
||||
return self.getconf('oauth2_request_url', None)
|
||||
#raise OfflineImapError("No remote oauth2_request_url for repository "
|
||||
#"'%s' specified."% self, OfflineImapError.ERROR.REPO)
|
||||
|
||||
def getoauth2_refresh_token(self):
|
||||
return self.getconf('oauth2_refresh_token', None)
|
||||
|
Loading…
Reference in New Issue
Block a user