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
|
Gmail implementation first checks for the usual IMAP settings
|
||||||
and falls back to imap.gmail.com if not specified."""
|
and falls back to imap.gmail.com if not specified."""
|
||||||
try:
|
|
||||||
return super(GmailRepository, self).getoauth2_request_url()
|
url = super(GmailRepository, self).getoauth2_request_url()
|
||||||
except OfflineImapError:
|
if url is None:
|
||||||
# nothing was configured, cache and return hardcoded one
|
# Nothing was configured, cache and return hardcoded one.
|
||||||
self._oauth2_request_url = GmailRepository.OAUTH2_URL
|
self._oauth2_request_url = GmailRepository.OAUTH2_URL
|
||||||
return self._oauth2_request_url
|
return self._oauth2_request_url
|
||||||
|
|
||||||
def getport(self):
|
def getport(self):
|
||||||
return GmailRepository.PORT
|
return GmailRepository.PORT
|
||||||
|
@ -259,7 +259,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
return [f.strip().lower() for f in value.split(',') if f]
|
return [f.strip().lower() for f in value.split(',') if f]
|
||||||
|
|
||||||
def getoauth2_request_url(self):
|
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
|
return self._oauth2_request_url
|
||||||
|
|
||||||
oauth2_request_url = self.getconf('oauth2_request_url', None)
|
oauth2_request_url = self.getconf('oauth2_request_url', None)
|
||||||
@ -267,11 +267,8 @@ class IMAPRepository(BaseRepository):
|
|||||||
self._oauth2_request_url = oauth2_request_url
|
self._oauth2_request_url = oauth2_request_url
|
||||||
return self._oauth2_request_url
|
return self._oauth2_request_url
|
||||||
|
|
||||||
# no success
|
#raise OfflineImapError("No remote oauth2_request_url for repository "
|
||||||
raise OfflineImapError("No remote oauth2_request_url for repository "\
|
#"'%s' specified."% self, OfflineImapError.ERROR.REPO)
|
||||||
"'%s' specified." % self,
|
|
||||||
OfflineImapError.ERROR.REPO)
|
|
||||||
return self.getconf('oauth2_request_url', None)
|
|
||||||
|
|
||||||
def getoauth2_refresh_token(self):
|
def getoauth2_refresh_token(self):
|
||||||
return self.getconf('oauth2_refresh_token', None)
|
return self.getconf('oauth2_refresh_token', None)
|
||||||
|
Loading…
Reference in New Issue
Block a user