[Mpuls-commits] r3417 - in jmd/trunk: . jmdweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 17 12:46:57 CEST 2010


Author: bh
Date: 2010-08-17 12:46:56 +0200 (Tue, 17 Aug 2010)
New Revision: 3417

Modified:
   jmd/trunk/ChangeLog
   jmd/trunk/jmdweb/lib/search.py
Log:
* jmdweb/lib/search.py (CaseSearch.get_where): Removed.  The
base-class version is enough now.
(SEARCH_WHERE): Removed. No longer needed.


Modified: jmd/trunk/ChangeLog
===================================================================
--- jmd/trunk/ChangeLog	2010-08-17 10:35:35 UTC (rev 3416)
+++ jmd/trunk/ChangeLog	2010-08-17 10:46:56 UTC (rev 3417)
@@ -1,3 +1,9 @@
+2010-08-17  Bernhard Herzog  <bh at intevation.de>
+
+	* jmdweb/lib/search.py (CaseSearch.get_where): Removed.  The
+	base-class version is enough now.
+	(SEARCH_WHERE): Removed. No longer needed.
+
 2010-08-11  Bernhard Herzog  <bh at intevation.de>
 
 	* jmdweb/lib/session.py (MPulsSession): New.  Inherit from the

Modified: jmd/trunk/jmdweb/lib/search.py
===================================================================
--- jmd/trunk/jmdweb/lib/search.py	2010-08-17 10:35:35 UTC (rev 3416)
+++ jmd/trunk/jmdweb/lib/search.py	2010-08-17 10:46:56 UTC (rev 3417)
@@ -28,88 +28,15 @@
 # Torsten Irländer <torsten.irlaender at intevation.de>
 
 import logging
-from datetime import datetime
-
-from mpulsweb.lib.security import hasRole
 from mpulsweb.lib.search import CaseSearch as CaseBaseSearch
-from mpulsweb.model.phase import PhaseFactory 
 
-SEARCH_WHERE = """
-      %s
-      AND st.status IN (%s)
-      AND %s
-      AND %s
-      AND %s
-      AND %s
-"""
 
 log = logging.getLogger(__name__)
 
 
 class CaseSearch(CaseBaseSearch):
 
-    def get_where(self, search, options, allowed_states, bad_types, phaseslist,
-                  fieldsdic):
-        # Ansicht eigene Fallakten / Vertretung
-        which_user = 0
-        allowed_viewer = "FALSE"
-        if options.has_key('own'):
-            which_user += 2
-        if options.has_key('standin'):
-            which_user += 1
-        if which_user == 1:
-            allowed_viewer = "m.bearbeiter_id <> %s" % options.get('standin')
-        if which_user == 2:
-            allowed_viewer = "m.bearbeiter_id = %s" % options.get('own')
-        if which_user == 3:
-            allowed_viewer = "TRUE"
-        allowed_viewer = (hasRole(['admin_ka', 'pb_ka'])
-                          and "TRUE" or allowed_viewer)
-        # Bearbeiter
-        editor = (options.has_key('editor')
-                  and "m.bearbeiter_id = %s" % options.get('editor') or "TRUE")
+    pass
 
-        #Phases
-        phases = 'FALSE' #default
-        if phaseslist:
-            phases = ('m.id in'
-                      ' (SELECT id from master_tbl_view WHERE phase IN (%s))'
-                      % ','.join([str(p) for p in phaseslist]))
 
-        fields = {'needle': ""}
-        fields['needle'] = " ".join(search)
-        needle_expr = ("((%s) OR (%s))"
-                       % (" OR ".join("m.%s ~* '%%(needle)s'"
-                                      % field
-                                      for field in self.match_fields),
-                          " AND ".join("m.%s IS NULL"
-                                       % field
-                                       for field in self.match_fields)))
-
-        #Dates
-        time_interval = "TRUE"
-        if (options.get('sdate') and options.get('edate')):
-            sd = options.get('sdate')
-            ed = options.get('edate')
-            time_interval_str = []
-            phasepairs = PhaseFactory().build()
-            for p in phasepairs:
-                sp = p.getStart()
-                ep = p.getEnd()
-                time_interval_str.append('''
-                    (m.phase IN (%s, %s) 
-                    AND (%s::date <= '%s'::date)
-                    AND (coalesce(%s, now())::date >= '%s'::date))
-                ''' % (sp.id, ep.id, sp.datefield, ed, ep.datefield, sd))
-            if -1 in phaseslist:
-                time_interval_str.append("(m.phase = -1)")
-            time_interval = "(%s)" % "OR".join(time_interval_str)
-
-        needle_expr = needle_expr % fields
-
-        return SEARCH_WHERE % (needle_expr,
-                               ",".join([str(x) for x in allowed_states]),
-                               allowed_viewer, editor,
-                               time_interval, phases)
-
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list