[Mpuls-commits] r4971 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed May 18 08:58:10 CEST 2011
Author: torsten
Date: 2011-05-18 08:58:09 +0200 (Wed, 18 May 2011)
New Revision: 4971
Modified:
base/trunk/mpulsweb/lib/helpers.py
Log:
Added docstring to get_sorted_db_from_selectionlist. Make filtering of selectionlist more robust. Fixed handling of c.filter attribute.
Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py 2011-05-16 13:49:07 UTC (rev 4970)
+++ base/trunk/mpulsweb/lib/helpers.py 2011-05-18 06:58:09 UTC (rev 4971)
@@ -99,8 +99,11 @@
# Helper functions used in the UI to show some information like status messages
# or icons
-def get_sorted_db_from_selectionlist(filter=None):
- """Returns a sorted list of available dbs"""
+def get_sorted_db_from_selectionlist(filter=""):
+ """Returns a sorted list of available dbs. dbnames are useually defined as
+ a name followed by a number (i.e inte00010). Sorting will be done on the
+ numberpart. If dbname does not contain any number the assume number '0'
+ which results in no sorting. """
d = get_db_selectionlist(filter)
s = {}
name = re.compile('\D*')
@@ -114,10 +117,10 @@
l.append(s.get(id))
return l
-def get_db_selectionlist(filter=None):
+def get_db_selectionlist(filter=""):
"""Returns a dictionarie used for listing available db on the loginscreen."""
dblist = g.mpuls_dblist.get_list()
- if filter is None: return dblist
+ if filter is "": return dblist
filtered_dblist = {}
for k in dblist.keys():
if not filter.match(k): continue
More information about the Mpuls-commits
mailing list