[Mpuls-commits] r4027 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 26 18:20:40 CEST 2010


Author: torsten
Date: 2010-10-26 18:20:39 +0200 (Tue, 26 Oct 2010)
New Revision: 4027

Modified:
   base/trunk/mpulsweb/lib/config.py
Log:
* mpulsweb/lib/config.py: Added new class "MpulsDBList" to load db lists form json file.


Modified: base/trunk/mpulsweb/lib/config.py
===================================================================
--- base/trunk/mpulsweb/lib/config.py	2010-10-26 16:19:22 UTC (rev 4026)
+++ base/trunk/mpulsweb/lib/config.py	2010-10-26 16:20:39 UTC (rev 4027)
@@ -421,4 +421,28 @@
             return mapping[0]
         else: return {}
 
+class MpulsDBList(MpulsConfig):
+
+    def build_defaults(self):
+        """Build a list of available DB"""
+
+        sections = {}
+
+        def set(section_key, item_key, item):
+            try:
+                section = sections[section_key]
+            except KeyError:
+                section = {}
+                sections[section_key] = section
+            section[item_key] = item
+        dblist= {}
+        set('db', 'list', [dblist])
+        return sections
+
+    def get_list(self):
+        dblist= self.get('db', 'list')
+        if dblist != '':
+            return dblist[0]
+        else: return {}
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list