summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/config
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-06-27 12:47:57 -0300
committerTomás Touceda <chiiph@leap.se>2014-06-27 12:47:57 -0300
commit7858d83af4a09ab00f6ba33dd8dbcf07ade101ce (patch)
tree334e519a4d341c402b5fa81d339b9b1d2b5ead35 /src/leap/bitmask/config
parentc621fa7322b4f8151eb37b27f8aeae563cf6bd63 (diff)
parent7de085576dd6141a5303aa1e1460c2a208d7b5d4 (diff)
Merge branch 'release-0.5.3'0.5.3
Diffstat (limited to 'src/leap/bitmask/config')
-rw-r--r--src/leap/bitmask/config/providerconfig.py55
1 files changed, 17 insertions, 38 deletions
diff --git a/src/leap/bitmask/config/providerconfig.py b/src/leap/bitmask/config/providerconfig.py
index cf31b3b2..7b979e61 100644
--- a/src/leap/bitmask/config/providerconfig.py
+++ b/src/leap/bitmask/config/providerconfig.py
@@ -38,35 +38,6 @@ class MissingCACert(Exception):
pass
-class ProviderConfigLight(object):
- """
- A light config object to hold some provider settings needed by the GUI.
- """
- def __init__(self):
- """
- Define the public attributes.
- """
- self.domain = ""
- self.name = ""
- self.description = ""
- self.enrollment_policy = ""
- self.services = []
-
- @property
- def services_string(self):
- """
- Return a comma separated list of serices provided by this provider.
-
- :rtype: str
- """
- services = []
- for service in self.services:
- services.append(get_service_display_name(service))
-
- services_str = ", ".join(services)
- return services_str
-
-
class ProviderConfig(BaseConfig):
"""
Provider configuration abstraction class
@@ -76,24 +47,32 @@ class ProviderConfig(BaseConfig):
def get_light_config(self, domain, lang=None):
"""
- Return a ProviderConfigLight object with the data for the loaded
- object.
+ Return a dict with the data for the loaded object.
:param domain: the domain name of the provider.
:type domain: str
:param lang: the language to use for localized strings.
:type lang: str
- :rtype: ProviderConfigLight or None if the ProviderConfig isn't loaded.
+ :rtype: dict or None if the ProviderConfig isn't loaded.
"""
config = self.get_provider_config(domain)
- details = ProviderConfigLight()
- details.domain = config.get_domain()
- details.name = config.get_name(lang=lang)
- details.description = config.get_description(lang=lang)
- details.enrollment_policy = config.get_enrollment_policy()
- details.services = config.get_services()
+ if config is None:
+ return
+
+ details = {}
+ details["domain"] = config.get_domain()
+ details["name"] = config.get_name(lang=lang)
+ details["description"] = config.get_description(lang=lang)
+ details["enrollment_policy"] = config.get_enrollment_policy()
+ details["services"] = config.get_services()
+
+ services = []
+ for service in config.get_services():
+ services.append(get_service_display_name(service))
+
+ details['services_string'] = ", ".join(services)
return details