]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
Adding an info class that reads in global configuration.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jan 2010 10:32:18 +0000 (11:32 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jan 2010 10:32:18 +0000 (11:32 +0100)
www/webapp/info.py [new file with mode: 0644]

diff --git a/www/webapp/info.py b/www/webapp/info.py
new file mode 100644 (file)
index 0000000..18754fa
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import simplejson
+
+class Info(dict):
+       def __init__(self, filename):
+               self.load(filename)
+               
+       def load(self, filename):
+               f = open(filename)
+               for key, val in simplejson.loads(f.read()).items():
+                       self[key] = val
+               f.close()
+
+
+info = Info("info.json")