aboutsummaryrefslogtreecommitdiff
path: root/dodai/config/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'dodai/config/__init__.py')
-rw-r--r--dodai/config/__init__.py50
1 files changed, 21 insertions, 29 deletions
diff --git a/dodai/config/__init__.py b/dodai/config/__init__.py
index 9eac0da..b976dca 100644
--- a/dodai/config/__init__.py
+++ b/dodai/config/__init__.py
@@ -16,7 +16,6 @@
16# along with Dodai. If not, see <http://www.gnu.org/licenses/>. 16# along with Dodai. If not, see <http://www.gnu.org/licenses/>.
17 17
18 18
19
20class Config(object): 19class Config(object):
21 20
22 def __call__(self): 21 def __call__(self):
@@ -26,38 +25,31 @@ class Config(object):
26 setattr(obj, key, val) 25 setattr(obj, key, val)
27 return obj 26 return obj
28 27
29 def set(self, key, val): 28 def __getattr__(self, key):
30 if not hasattr(self, 'vars'):
31 self.vars = {}
32 self.vars[key] = val
33 29
34 def options(self): 30 if 'files' == key:
35 if not hasattr(self, '_options'): 31 from dodai.config.files import ConfigFiles
32 self.files = ConfigFiles()
33 return self.files
34 elif 'options' == key:
36 from dodai.config.option import ConfigOption 35 from dodai.config.option import ConfigOption
37 self._options = ConfigOption() 36 self.options = ConfigOption()
38 return self._options 37 return self.options
39 38 elif 'logs' == key:
40 def files(self):
41 if not hasattr(self, '_files'):
42 from dodai.config.file import ConfigFile
43 self._files = ConfigFile()
44 return self._files
45
46 def logs(self):
47 if not hasattr(self, '_logs'):
48 from dodai.config.log import ConfigLog 39 from dodai.config.log import ConfigLog
49 self._logs = ConfigLog() 40 self.logs = ConfigLog()
50 return self._logs 41 return self.logs
51 42 elif 'databases' == key:
52 def dbs(self): 43 from dodai.config.databases import ConfigDatabases
53 if not hasattr(self, '_dbs'): 44 self.databases = ConfigDatabases()
54 from dodai.config.db import ConfigDb 45 return self.databases
55 self._dbs = ConfigDb() 46 else:
56 return self._dbs 47 raise KeyError(key)
57
58
59
60 48
49 def set(self, key, val):
50 if not hasattr(self, 'vars'):
51 self.vars = {}
52 self.vars[key] = val
61 53
62 54
63class ConfigResults(object): 55class ConfigResults(object):