[Mpuls-commits] r5424 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 7 19:01:54 CEST 2011


Author: bh
Date: 2011-10-07 19:01:54 +0200 (Fri, 07 Oct 2011)
New Revision: 5424

Modified:
   base/trunk/mpulsweb/lib/search.py
Log:
Fix formatting.


Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2011-10-07 16:13:11 UTC (rev 5423)
+++ base/trunk/mpulsweb/lib/search.py	2011-10-07 17:01:54 UTC (rev 5424)
@@ -23,7 +23,7 @@
         class to configure application spectific behavior of the search which
         is common to the case and evaluation search. This class can be
         overwritten in the application specific /lib/search.py
-    """ 
+    """
 
 class Search(object):
 
@@ -231,7 +231,7 @@
                     if phases:
                         search_options["phase"] = phases
 
-            # Federal state 
+            # Federal state
             if (options.get("federal_state") is not None):
                 search_options["federal_state"] = options.get("federal_state")
 
@@ -496,15 +496,16 @@
         SQL = self.SEARCH_QUERY % sql_fields
         return SQL
 
+
 class EvaluationSearch(Search):
 
     SEARCH_QUERY = """
-    SELECT %(fields)s 
-    FROM fkz_tbl f 
-    LEFT OUTER JOIN (SELECT m.fkz, m.id, st.zugriff  FROM 
-    master_tbl_view m 
+    SELECT %(fields)s
+    FROM fkz_tbl f
+    LEFT OUTER JOIN (SELECT m.fkz, m.id, st.zugriff  FROM
+    master_tbl_view m
     JOIN ka_status_tbl_view st ON m.id = st.master_id
-    JOIN ka_benutzer_tbl b ON m.bearbeiter_id = b.id 
+    JOIN ka_benutzer_tbl b ON m.bearbeiter_id = b.id
     JOIN fkz_tbl f ON f.id::integer = m.fkz::integer
     WHERE %(where)s) m
     ON f.id::integer = m.fkz::integer
@@ -512,11 +513,14 @@
     %(order)s
     """
 
-    SEARCH_FIELDS = """m.fkz as id, f.fkz, f.name, f.bundesland_id, count(m.id) as count, max(m.zugriff) as time"""
+    SEARCH_FIELDS = """m.fkz as id, f.fkz, f.name, f.bundesland_id,
+    count(m.id) as count, max(m.zugriff) as time
+    """
 
     VALID_OPTIONS = (Search.VALID_OPTIONS
                      + ("state", "phase", "own", "standin", "editor", "branch",
-                        "sdate", "edate", "sort_field", "sort_order", "federal_state"))
+                        "sdate", "edate", "sort_field", "sort_order",
+                        "federal_state"))
     MULTI_OPTIONS = Search.MULTI_OPTIONS + ('state', 'phase', 'federal_state')
 
 
@@ -552,9 +556,12 @@
         return "TRUE"
 
     def get_federalstate_clause(self, options):
-        """Return the search condition to select cases based on federal state."""
+        """Return the search condition to select cases based on federal state.
+        """
         if options.get('federal_state'):
-            return "m.fkz::integer in (SELECT id from fkz_tbl where bundesland_id in ( %s ))" % ",".join([str(x) for x in options.get('federal_state')])
+            return ("m.fkz::integer in"
+                    " (SELECT id FROM fkz_tbl WHERE bundesland_id in (%s))"
+                    % ",".join([str(x) for x in options.get('federal_state')]))
         return "TRUE"
 
     def get_fields(self, options):
@@ -566,7 +573,8 @@
         return self.SEARCH_ORDER % (sort_field, sort_order)
 
     def get_group(self, options):
-        group_field = options.get('group_field', "f.fkz, m.fkz, f.name, f.bundesland_id")
+        group_field = options.get('group_field',
+                                  "f.fkz, m.fkz, f.name, f.bundesland_id")
         return self.GROUP_BY % (group_field)
 
     def _build_sql(self, options):



More information about the Mpuls-commits mailing list