[Mpuls-commits] r3436 - in wasko/trunk: . waskoweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Aug 18 12:17:56 CEST 2010
Author: bh
Date: 2010-08-18 12:17:55 +0200 (Wed, 18 Aug 2010)
New Revision: 3436
Modified:
wasko/trunk/ChangeLog
wasko/trunk/waskoweb/lib/search.py
Log:
* waskoweb/lib/search.py (CaseSearch.VALID_OPTIONS): Extend the
base class value with "gender"
(CaseSearch.wasko_gender_mapping): New. Map generic mpuls values to the
waso specific ones.
(CaseSearch.get_gender_clause): New. Implement the gender search
criterion
Modified: wasko/trunk/ChangeLog
===================================================================
--- wasko/trunk/ChangeLog 2010-08-17 19:12:27 UTC (rev 3435)
+++ wasko/trunk/ChangeLog 2010-08-18 10:17:55 UTC (rev 3436)
@@ -1,3 +1,12 @@
+2010-08-18 Bernhard Herzog <bh at intevation.de>
+
+ * waskoweb/lib/search.py (CaseSearch.VALID_OPTIONS): Extend the
+ base class value with "gender"
+ (CaseSearch.wasko_gender_mapping): New. Map generic mpuls values to the
+ waso specific ones.
+ (CaseSearch.get_gender_clause): New. Implement the gender search
+ criterion
+
2010-08-17 Bernhard Herzog <bh at intevation.de>
* waskoweb/lib/search.py: Remove unused imports.
Modified: wasko/trunk/waskoweb/lib/search.py
===================================================================
--- wasko/trunk/waskoweb/lib/search.py 2010-08-17 19:12:27 UTC (rev 3435)
+++ wasko/trunk/waskoweb/lib/search.py 2010-08-18 10:17:55 UTC (rev 3436)
@@ -37,6 +37,18 @@
class CaseSearch(CaseBaseSearch):
- pass
+ VALID_OPTIONS = (CaseBaseSearch.VALID_OPTIONS
+ + ("gender",))
+ # In wasko, the values for male and female are swapped.
+ wasko_gender_mapping = {1: 0, 0: 1}
+
+ def get_gender_clause(self, search, options):
+ gender = options.get("gender")
+ if gender is not None:
+ return ("m.geschlecht = %s"
+ % self.wasko_gender_mapping.get(gender, gender))
+ return "TRUE"
+
+
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list