[Mpuls-commits] r3426 - in waska/trunk: . waskaweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 17 19:15:40 CEST 2010
Author: bh
Date: 2010-08-17 19:15:40 +0200 (Tue, 17 Aug 2010)
New Revision: 3426
Modified:
waska/trunk/ChangeLog
waska/trunk/waskaweb/lib/search.py
Log:
* waskaweb/lib/search.py: Remove unused imports.
(SEARCH_WHERE): Removed. No longer needed.
(CaseSearch.get_where): Removed. The base class method should be
equivalent.
Modified: waska/trunk/ChangeLog
===================================================================
--- waska/trunk/ChangeLog 2010-08-17 17:13:17 UTC (rev 3425)
+++ waska/trunk/ChangeLog 2010-08-17 17:15:40 UTC (rev 3426)
@@ -1,3 +1,10 @@
+2010-08-17 Bernhard Herzog <bh at intevation.de>
+
+ * waskaweb/lib/search.py: Remove unused imports.
+ (SEARCH_WHERE): Removed. No longer needed.
+ (CaseSearch.get_where): Removed. The base class method should be
+ equivalent.
+
2010-08-09 Torsten Irländer <torsten.irlaender at intevation.de>
Issue905:
Modified: waska/trunk/waskaweb/lib/search.py
===================================================================
--- waska/trunk/waskaweb/lib/search.py 2010-08-17 17:13:17 UTC (rev 3425)
+++ waska/trunk/waskaweb/lib/search.py 2010-08-17 17:15:40 UTC (rev 3426)
@@ -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