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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 16 17:30:10 CET 2010


Author: torsten
Date: 2010-11-16 17:30:09 +0100 (Tue, 16 Nov 2010)
New Revision: 4196

Modified:
   base/trunk/mpulsweb/lib/helpers.py
Log:
* mpulsweb/lib/helpers.py: Added function to return a sorted list of
	available dbs.


Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py	2010-11-16 12:12:45 UTC (rev 4195)
+++ base/trunk/mpulsweb/lib/helpers.py	2010-11-16 16:30:09 UTC (rev 4196)
@@ -160,6 +160,20 @@
 # Helper functions used in the UI to show some information like status messages
 # or icons
 
+def get_sorted_db_from_selectionlist():
+    """Returns a sorted list of available dbs"""
+    d = get_db_selectionlist()
+    s = {} 
+    name = re.compile('\D*')
+    for k in d.keys():
+        i = int(name.split(k)[1])
+        s[i] = k
+
+    l = []
+    for id in sorted(s.keys()):
+        l.append(s.get(id))
+    return l
+
 def get_db_selectionlist():
     """Returns a dictionarie used for listing available db on the loginscreen."""
     dblist = g.mpuls_dblist.get_list()



More information about the Mpuls-commits mailing list