[Mpuls-commits] r3428 - in base/trunk: . mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 17 20:32:16 CEST 2010
Author: bh
Date: 2010-08-17 20:32:13 +0200 (Tue, 17 Aug 2010)
New Revision: 3428
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (VALID_OPTIONS, Search.VALID_OPTIONS):
Move the list of valid options into the search classes so that
they can be extended derived mpuls applications.
(Search._parse_search_str): Adapt to new location of VALID_OPTIONS
(CaseSearch.VALID_OPTIONS): Extend the base class options with the
standard options of the CaseSearch class
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-08-17 17:53:12 UTC (rev 3427)
+++ base/trunk/ChangeLog 2010-08-17 18:32:13 UTC (rev 3428)
@@ -1,5 +1,14 @@
2010-08-17 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/lib/search.py (VALID_OPTIONS, Search.VALID_OPTIONS):
+ Move the list of valid options into the search classes so that
+ they can be extended derived mpuls applications.
+ (Search._parse_search_str): Adapt to new location of VALID_OPTIONS
+ (CaseSearch.VALID_OPTIONS): Extend the base class options with the
+ standard options of the CaseSearch class
+
+2010-08-17 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/search.py (Search._parse_search_str): Remove
bad_types and fields from return value. They are always emtpy.
Put allowed_states and phases into the options dict and do not
Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py 2010-08-17 17:53:12 UTC (rev 3427)
+++ base/trunk/mpulsweb/lib/search.py 2010-08-17 18:32:13 UTC (rev 3428)
@@ -11,12 +11,6 @@
SAVE_SEARCH = re.compile(r'[^\w:;\-\. ]', re.UNICODE)
-VALID_OPTIONS = ['editor', 'migration', 'own', 'standin', 'state',
- 'sort_field', 'sort_order', 'interval_start_date',
- 'interval_end_date', 'interval_start_field',
- 'interval_end_field', 'gender', 'phase', 'branch', 'fkz',
- 'inconsistency', 'only_cases_after', 'bad', 'field',
- 'sdate', 'edate']
SEARCH_QUERY = """
SELECT %(fields)s
FROM master_tbl_view m
@@ -37,6 +31,8 @@
class Search(object):
+ VALID_OPTIONS = ('state', 'phase')
+
def __init__(self):
pass
@@ -55,7 +51,7 @@
if option.find(":") > 0:
try:
key, value = [x.strip() for x in option.split(":")]
- if key in VALID_OPTIONS:
+ if key in self.VALID_OPTIONS:
if key == 'state':
allowed_states.append(int(value))
if key == 'phase':
@@ -96,6 +92,11 @@
class CaseSearch(Search):
+ VALID_OPTIONS = (Search.VALID_OPTIONS
+ + ("own", "standin", "editor", "sdate", "edate",
+ "sort_field", "sort_order"))
+
+
def __init__(self, retrieve_fields, match_fields):
Search.__init__(self)
self.retrieve_fields = retrieve_fields
More information about the Mpuls-commits
mailing list