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__.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/dodai/config/__init__.py b/dodai/config/__init__.py
new file mode 100644
index 0000000..aac9be7
--- /dev/null
+++ b/dodai/config/__init__.py
@@ -0,0 +1,64 @@
1# Copyright (C) 2010 Leonard Thomas
2#
3# This file is part of Dodai.
4#
5# Dodai is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# Dodai is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with Dodai. If not, see <http://www.gnu.org/licenses/>.
17
18
19
20class Config(object):
21
22 def __call__(self):
23 obj = ConfigResults()
24 if hasattr(self, 'vars'):
25 for key, val in self.vars.items():
26 setattr(obj, key, val)
27 return obj
28
29 def set(self, key, val):
30 if not hasattr(self, 'vars'):
31 self.vars = {}
32 self.vars[key] = val
33
34 def options(self):
35 if not hasattr(self, '_options'):
36 from dodai.config.option import ConfigOption
37 self._options = ConfigOption()
38 return self._options
39
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
49 self._logs = ConfigLog()
50 return self._logs
51
52 def dbs(self):
53 if not hasattr(self, '_dbs'):
54 from dodai.config.db import ConfigDb
55 self._dbs = ConfigDb()
56 return self._dbs
57
58
59
60
61
62
63class ConfigResults(object):
64 pass