aboutsummaryrefslogtreecommitdiffstats
path: root/IRC/getconf.py
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-12-18 16:32:41 +0100
committertv <tv@nomic.retiolum>2013-12-18 16:32:41 +0100
commitaa7cd8834b21a064e4fe0440b956f6c174949ed2 (patch)
tree4e9a17a838dc3c6cec28954ad69a9b84057da33c /IRC/getconf.py
parent8a9c41f399dd874b246818bb81f4c9edbf9a9549 (diff)
Reaktor: s/(config).json/\1.py/
Diffstat (limited to 'IRC/getconf.py')
-rw-r--r--IRC/getconf.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/IRC/getconf.py b/IRC/getconf.py
index 5fdd1cd..d6e9f42 100644
--- a/IRC/getconf.py
+++ b/IRC/getconf.py
@@ -2,19 +2,29 @@
#getconf(key) -> value
#oder error
-import json
+import imp
+import os
+
def make_getconf(filename):
+
+ config = load_config(filename)
+
def getconf(prop):
prop_split = prop.split('.')
string = ''
- file = open(filename)
- for line in file.readlines():
- string+=line
- parsed = json.loads(string)
- tmp = parsed
+ imp.reload(config)
+ tmp = config.__dict__
for pr in prop_split:
tmp = tmp[pr]
-
return tmp
+
return getconf
+
+
+def load_config(filename):
+ dirname = os.path.dirname(filename)
+ modname, ext = os.path.splitext(os.path.basename(filename))
+ file, pathname, description = imp.find_module(modname, [ dirname ])
+ return imp.load_module(modname, file, pathname, description)
+