diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-06 18:05:06 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-07 14:13:09 -0300 |
commit | 4ee2773660a571b180732ef41446399edf8501ac (patch) | |
tree | c6cfc7b6a3b87fb585c6eac0f38db03e22b7787f /src/leap/services/mail | |
parent | baf3738bec7a712f90316f79255d4c91259e3fdf (diff) |
Update code to use the new SMTP schema selection.
Diffstat (limited to 'src/leap/services/mail')
-rw-r--r-- | src/leap/services/mail/smtpbootstrapper.py | 8 | ||||
-rw-r--r-- | src/leap/services/mail/smtpconfig.py | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/leap/services/mail/smtpbootstrapper.py b/src/leap/services/mail/smtpbootstrapper.py index e8af5349..48040035 100644 --- a/src/leap/services/mail/smtpbootstrapper.py +++ b/src/leap/services/mail/smtpbootstrapper.py @@ -72,10 +72,12 @@ class SMTPBootstrapper(AbstractBootstrapper): if self._download_if_needed and mtime: headers['if-modified-since'] = mtime + api_version = self._provider_config.get_api_version() + # there is some confusion with this uri, config_uri = "%s/%s/config/smtp-service.json" % ( - self._provider_config.get_api_uri(), - self._provider_config.get_api_version()) + self._provider_config.get_api_uri(), api_version) + logger.debug('Downloading SMTP config from: %s' % config_uri) srp_auth = SRPAuth(self._provider_config) @@ -91,6 +93,8 @@ class SMTPBootstrapper(AbstractBootstrapper): cookies=cookies) res.raise_for_status() + self._smtp_config.set_api_version(api_version) + # Not modified if res.status_code == 304: logger.debug("SMTP definition has not been modified") diff --git a/src/leap/services/mail/smtpconfig.py b/src/leap/services/mail/smtpconfig.py index 30371005..ca974fcf 100644 --- a/src/leap/services/mail/smtpconfig.py +++ b/src/leap/services/mail/smtpconfig.py @@ -21,7 +21,7 @@ SMTP configuration import logging from leap.common.config.baseconfig import BaseConfig -from leap.services.mail.smtpspec import smtp_config_spec +from leap.services.mail.smtpspec import get_schema logger = logging.getLogger(__name__) @@ -33,12 +33,7 @@ class SMTPConfig(BaseConfig): def __init__(self): BaseConfig.__init__(self) - - def _get_spec(self): - """ - Returns the spec object for the specific configuration - """ - return smtp_config_spec + self._get_schema = get_schema def get_hosts(self): return self._safe_get_value("hosts") |