[Mpuls-commits] r2240 - in wasko/branches/2.0: . mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 29 17:44:15 CEST 2010
Author: bh
Date: 2010-03-29 17:44:11 +0200 (Mon, 29 Mar 2010)
New Revision: 2240
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py: Fix formatting.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-29 15:39:11 UTC (rev 2239)
+++ wasko/branches/2.0/ChangeLog 2010-03-29 15:44:11 UTC (rev 2240)
@@ -1,5 +1,9 @@
2010-03-29 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/lib/search.py: Fix formatting.
+
+2010-03-29 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/security.py: Remove unused imports.
2010-03-29 Bernhard Herzog <bh at intevation.de>
Modified: wasko/branches/2.0/mpulsweb/lib/search.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/search.py 2010-03-29 15:39:11 UTC (rev 2239)
+++ wasko/branches/2.0/mpulsweb/lib/search.py 2010-03-29 15:44:11 UTC (rev 2240)
@@ -29,6 +29,7 @@
log = logging.getLogger(__name__)
+
class Search(object):
def __init__(self):
@@ -86,11 +87,12 @@
'''Returns the result set of a search based on the search string'''
search, options, states, bad_types, phases, fields = \
self._parse_search_str(search_str)
- sql = self._build_sql(search, options, states, bad_types,
- phases, fields)
+ sql = self._build_sql(search, options, states, bad_types, phases,
+ fields)
result = self.queryDB(sql)
return result
+
class CaseSearch(Search):
def __init__(self, retrieve_fields, match_fields):
@@ -100,11 +102,13 @@
def __get_fields(self, options):
retrieve = ", ".join("m." + field for field in self.retrieve_fields)
- if retrieve: retrieve = "%s," % retrieve
+ if retrieve:
+ retrieve = "%s," % retrieve
return SEARCH_FIELDS % retrieve
- def __get_where(self, search, options, allowed_states, bad_types, phaseslist, fieldsdic):
- return "TRUE"
+ def __get_where(self, search, options, allowed_states, bad_types,
+ phaseslist, fieldsdic):
+ return "TRUE"
def __get_order(self, options):
sort_field = options.get('sort_field', "name")
@@ -113,16 +117,15 @@
def _build_sql(self, search, options, allowed_states, bad_types, phaseslist,
fieldsdic):
-
sql_fields = {}
sql_fields['fields'] = self.__get_fields(options)
- sql_fields['where'] = self.__get_where(search, options, allowed_states,
- bad_types, phaseslist, fieldsdic)
- sql_fields['order'] = self.__get_order(options)
+ sql_fields['where'] = self.__get_where(search, options, allowed_states,
+ bad_types, phaseslist, fieldsdic)
+ sql_fields['order'] = self.__get_order(options)
log.debug(sql_fields)
SQL = SEARCH_QUERY % sql_fields
log.debug(SQL)
- return (SQL)
+ return SQL
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list