summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-08-07 14:50:16 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-08-07 15:25:42 -0300
commit98f014d99e13651e7dfb0789f8dac0a81aea172e (patch)
treef2430d40afbcc2b574431a946d6abff7cd08cd38
parent088db436880edd8c8ae51f792fc707d962927485 (diff)
Define abstract methods from BaseConfig.
-rw-r--r--src/leap/config/providerconfig.py17
-rw-r--r--src/leap/services/eip/eipconfig.py9
-rw-r--r--src/leap/services/mail/smtpconfig.py9
3 files changed, 31 insertions, 4 deletions
diff --git a/src/leap/config/providerconfig.py b/src/leap/config/providerconfig.py
index eb097034..f899b17c 100644
--- a/src/leap/config/providerconfig.py
+++ b/src/leap/config/providerconfig.py
@@ -42,12 +42,25 @@ class ProviderConfig(BaseConfig):
def __init__(self):
BaseConfig.__init__(self)
- def _get_spec(self):
+ def _get_schema(self):
"""
- Returns the spec object for the specific configuration
+ Returns the schema corresponding to the version given.
+
+ :rtype: dict or None if the version is not supported.
"""
return leap_provider_spec
+ def _get_spec(self):
+ """
+ Returns the spec object for the specific configuration.
+
+ Override the BaseConfig one because we do not support multiple schemas
+ for the provider yet.
+
+ :rtype: dict or None if the version is not supported.
+ """
+ return self._get_schema()
+
def get_api_uri(self):
return self._safe_get_value("api_uri")
diff --git a/src/leap/services/eip/eipconfig.py b/src/leap/services/eip/eipconfig.py
index da44c3a6..d69e1fd8 100644
--- a/src/leap/services/eip/eipconfig.py
+++ b/src/leap/services/eip/eipconfig.py
@@ -137,7 +137,14 @@ class EIPConfig(BaseConfig):
def __init__(self):
BaseConfig.__init__(self)
self._api_version = None
- self._get_schema = get_schema
+
+ def _get_schema(self):
+ """
+ Returns the schema corresponding to the version given.
+
+ :rtype: dict or None if the version is not supported.
+ """
+ return get_schema(self._api_version)
def get_clusters(self):
# TODO: create an abstraction for clusters
diff --git a/src/leap/services/mail/smtpconfig.py b/src/leap/services/mail/smtpconfig.py
index ca974fcf..ea0f9c37 100644
--- a/src/leap/services/mail/smtpconfig.py
+++ b/src/leap/services/mail/smtpconfig.py
@@ -33,7 +33,14 @@ class SMTPConfig(BaseConfig):
def __init__(self):
BaseConfig.__init__(self)
- self._get_schema = get_schema
+
+ def _get_schema(self):
+ """
+ Returns the schema corresponding to the version given.
+
+ :rtype: dict or None if the version is not supported.
+ """
+ return get_schema(self._api_version)
def get_hosts(self):
return self._safe_get_value("hosts")