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