summaryrefslogtreecommitdiffstats
path: root/ipsilon/providers/common.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-10-23 11:45:32 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2014-11-12 23:47:15 +0100
commit83da2bf3963db3e4427bced3b4c0681e751e54da (patch)
tree53f03ce8e60d2c68453cdb5fe6be9aad7ce2c362 /ipsilon/providers/common.py
parent0c14f7600de70baf5b3ee609288207dcdb65e1ae (diff)
downloadipsilon-83da2bf3963db3e4427bced3b4c0681e751e54da.tar.gz
ipsilon-83da2bf3963db3e4427bced3b4c0681e751e54da.tar.xz
ipsilon-83da2bf3963db3e4427bced3b4c0681e751e54da.zip
Refactor plugin configuration
Fork a PluginConfig class out of PluginObject, the base object now supports a simple dictionary config, while using PluginConfig provide access to structured util.config based configuration. Change UI code that deal with plugins configuration to properly use the new structured config objects in order to represent data in appropriate format based on the data type. Use the new util.config objects to represent plugins configuration. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/providers/common.py')
-rwxr-xr-xipsilon/providers/common.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/ipsilon/providers/common.py b/ipsilon/providers/common.py
index d882b40..ead50e2 100755
--- a/ipsilon/providers/common.py
+++ b/ipsilon/providers/common.py
@@ -18,8 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from ipsilon.util.log import Log
-from ipsilon.util.plugin import PluginLoader, PluginObject
-from ipsilon.util.plugin import PluginInstaller
+from ipsilon.util.plugin import PluginInstaller, PluginLoader
+from ipsilon.util.plugin import PluginObject, PluginConfig
from ipsilon.util.page import Page
import cherrypy
@@ -49,10 +49,11 @@ class InvalidRequest(ProviderException):
self._debug(message)
-class ProviderBase(PluginObject):
+class ProviderBase(PluginConfig, PluginObject):
def __init__(self, name, path):
- super(ProviderBase, self).__init__()
+ PluginConfig.__init__(self)
+ PluginObject.__init__(self)
self.name = name
self.path = path
self.tree = None
@@ -74,14 +75,14 @@ class ProviderBase(PluginObject):
# configure self
plugins = site[FACILITY]
if self.name in plugins['config']:
- self.set_config(plugins['config'][self.name])
+ self.import_config(plugins['config'][self.name])
# init pages and admin interfaces
self.tree = self.get_tree(site)
self._debug('IdP Provider registered: %s' % self.name)
- if self.get_config_value('enabled') == '1':
+ if self.get_config_value('enabled') is True:
# and enable self
self._enable(site)
@@ -97,7 +98,7 @@ class ProviderBase(PluginObject):
return
self._enable(site)
- self.set_config_value('enabled', '1')
+ self.set_config_value('enabled', True)
self.save_plugin_config(FACILITY)
def disable(self, site):
@@ -109,7 +110,7 @@ class ProviderBase(PluginObject):
root.del_subtree(self.name)
self.is_enabled = False
- self.set_config_value('enabled', '0')
+ self.set_config_value('enabled', False)
self.save_plugin_config(FACILITY)
self._debug('IdP Provider disabled: %s' % self.name)