[Mpuls-commits] r2260 - in wasko/branches/2.0: . jmdweb/lib mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 29 20:57:01 CEST 2010
Author: bh
Date: 2010-03-29 20:57:00 +0200 (Mon, 29 Mar 2010)
New Revision: 2260
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/jmdweb/lib/search.py
wasko/branches/2.0/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (CaseSearch.__get_fields)
(CaseSearch.__get_where, CaseSearch.__get_order): Removed the
leading underscores from the method names. These are methods that
are likely to be overwritten or extended by derived classes and
should not be private.
(CaseSearch.get_fields, CaseSearch.get_where)
(CaseSearch.get_order): The new names of the above methods.
(CaseSearch._build_sql): Adapt to new method names.
* jmdweb/lib/search.py (CaseSearch.__get_where)
(CaseSearch.get_where): Removed the underscore from the name like
in the base class. Overwriting the __get_where method worked only
by accident: base class and derived class have the same name, so
Python's name-mangling for private methods produces the same
names.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-29 18:47:01 UTC (rev 2259)
+++ wasko/branches/2.0/ChangeLog 2010-03-29 18:57:00 UTC (rev 2260)
@@ -1,5 +1,25 @@
2010-03-29 Bernhard Herzog <bh at intevation.de>
+ Fix naming of CaseSearch methods.
+
+ * mpulsweb/lib/search.py (CaseSearch.__get_fields)
+ (CaseSearch.__get_where, CaseSearch.__get_order): Removed the
+ leading underscores from the method names. These are methods that
+ are likely to be overwritten or extended by derived classes and
+ should not be private.
+ (CaseSearch.get_fields, CaseSearch.get_where)
+ (CaseSearch.get_order): The new names of the above methods.
+ (CaseSearch._build_sql): Adapt to new method names.
+
+ * jmdweb/lib/search.py (CaseSearch.__get_where)
+ (CaseSearch.get_where): Removed the underscore from the name like
+ in the base class. Overwriting the __get_where method worked only
+ by accident: base class and derived class have the same name, so
+ Python's name-mangling for private methods produces the same
+ names.
+
+2010-03-29 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/anonymize.py: Fix formatting.
2010-03-29 Bernhard Herzog <bh at intevation.de>
Modified: wasko/branches/2.0/jmdweb/lib/search.py
===================================================================
--- wasko/branches/2.0/jmdweb/lib/search.py 2010-03-29 18:47:01 UTC (rev 2259)
+++ wasko/branches/2.0/jmdweb/lib/search.py 2010-03-29 18:57:00 UTC (rev 2260)
@@ -54,8 +54,8 @@
class CaseSearch(CaseBaseSearch):
- def __get_where(self, search, options, allowed_states, bad_types,
- phaseslist, fieldsdic):
+ def get_where(self, search, options, allowed_states, bad_types, phaseslist,
+ fieldsdic):
# Ansicht eigene Fallakten / Vertretung
which_user = 0
allowed_viewer = "FALSE"
Modified: wasko/branches/2.0/mpulsweb/lib/search.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/search.py 2010-03-29 18:47:01 UTC (rev 2259)
+++ wasko/branches/2.0/mpulsweb/lib/search.py 2010-03-29 18:57:00 UTC (rev 2260)
@@ -99,17 +99,17 @@
self.retrieve_fields = retrieve_fields
self.match_fields = match_fields
- def __get_fields(self, options):
+ def get_fields(self, options):
retrieve = ", ".join("m." + field for field in self.retrieve_fields)
if retrieve:
retrieve = "%s," % retrieve
return SEARCH_FIELDS % retrieve
- def __get_where(self, search, options, allowed_states, bad_types,
- phaseslist, fieldsdic):
+ def get_where(self, search, options, allowed_states, bad_types,
+ phaseslist, fieldsdic):
return "TRUE"
- def __get_order(self, options):
+ def get_order(self, options):
sort_field = options.get('sort_field', "name")
sort_order = options.get('sort_order', "desc")
return SEARCH_ORDER % (sort_field, sort_order)
@@ -117,10 +117,10 @@
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['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)
log.debug(sql_fields)
SQL = SEARCH_QUERY % sql_fields
More information about the Mpuls-commits
mailing list