From 434bffc3b1ab4a74f0f23508e624e7427987aaf8 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 8 Apr 2015 09:44:14 -0400 Subject: Rename and move PluginConfig to ConfigHelper The configuration class was originally intended to be tied. At this point it is quite generic and useful outside of plugins. Rename it to something more generic and move it into the config module. https://fedorahosted.org/ipsilon/ticket/25 Signed-off-by: Rob Crittenden Reviewed-by: Simo Sorce --- ipsilon/util/plugin.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'ipsilon/util/plugin.py') diff --git a/ipsilon/util/plugin.py b/ipsilon/util/plugin.py index 1035ca8..be6dd2f 100644 --- a/ipsilon/util/plugin.py +++ b/ipsilon/util/plugin.py @@ -19,7 +19,6 @@ import os import imp import cherrypy import inspect -from ipsilon.util.config import Config from ipsilon.util.data import AdminStore from ipsilon.util.log import Log @@ -213,41 +212,3 @@ class PluginObject(Log): def wipe_data(self): self._data.wipe_data(self.name) - - -class PluginConfig(Log): - - def __init__(self): - self._config = None - - def new_config(self, name, *config_args): - self._config = Config(name, *config_args) - - def get_config_obj(self): - if self._config is None: - raise AttributeError('Config not initialized') - return self._config - - def import_config(self, config): - if not self._config: - raise AttributeError('Config not initialized, cannot import') - - for key, value in config.iteritems(): - if key in self._config: - self._config[key].import_value(str(value)) - - def export_config(self): - config = dict() - for name, option in self._config.iteritems(): - config[name] = option.export_value() - return config - - def get_config_value(self, name): - if not self._config: - raise AttributeError('Config not initialized') - return self._config[name].get_value() - - def set_config_value(self, name, value): - if not self._config: - raise AttributeError('Config not initialized') - return self._config[name].set_value(value) -- cgit