summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/config/providerconfig.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-10-01 12:36:28 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-10-01 12:36:28 -0300
commit0fa4712d10936329aa5012b3173bdd0fc0362e9f (patch)
treeae8e41e17dcb31ea8162c733eb298e9d956314c3 /src/leap/bitmask/config/providerconfig.py
parent95b69d0d2e9801e4db1fe3758b62ab9539ecf882 (diff)
parentfa3dcc727f3690439c57981ffa639453b395a618 (diff)
Merge remote-tracking branch 'chiiph/feature/new_ui' into develop
Diffstat (limited to 'src/leap/bitmask/config/providerconfig.py')
-rw-r--r--src/leap/bitmask/config/providerconfig.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/bitmask/config/providerconfig.py b/src/leap/bitmask/config/providerconfig.py
index c8c8a59e..44698d83 100644
--- a/src/leap/bitmask/config/providerconfig.py
+++ b/src/leap/bitmask/config/providerconfig.py
@@ -44,6 +44,25 @@ class ProviderConfig(BaseConfig):
def __init__(self):
BaseConfig.__init__(self)
+ @classmethod
+ def get_provider_config(self, domain):
+ """
+ Helper to return a valid Provider Config from the domain name.
+
+ :param domain: the domain name of the provider.
+ :type domain: str
+
+ :rtype: ProviderConfig or None if there is a problem loading the config
+ """
+ provider_config = ProviderConfig()
+ provider_config_path = os.path.join(
+ "leap", "providers", domain, "provider.json")
+
+ if not provider_config.load(provider_config_path):
+ provider_config = None
+
+ return provider_config
+
def _get_schema(self):
"""
Returns the schema corresponding to the version given.