[Mpuls-commits] r2214 - in wasko/branches/2.0: . mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Mar 25 20:22:19 CET 2010
Author: bh
Date: 2010-03-25 20:22:17 +0100 (Thu, 25 Mar 2010)
New Revision: 2214
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/controllers/case_overview.py
Log:
* mpulsweb/controllers/case_overview.py: Fix formatting.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-25 19:21:26 UTC (rev 2213)
+++ wasko/branches/2.0/ChangeLog 2010-03-25 19:22:17 UTC (rev 2214)
@@ -1,5 +1,9 @@
2010-03-25 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/controllers/case_overview.py: Fix formatting.
+
+2010-03-25 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/controllers/case_overview.py (parseSearchOptions):
Refactor code a little to make it more readable and to keep the
lines short
Modified: wasko/branches/2.0/mpulsweb/controllers/case_overview.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case_overview.py 2010-03-25 19:21:26 UTC (rev 2213)
+++ wasko/branches/2.0/mpulsweb/controllers/case_overview.py 2010-03-25 19:22:17 UTC (rev 2214)
@@ -12,11 +12,14 @@
from mpulsweb.model.user import UserListObject
from mpulsweb.model.case import MpulsCaseOverview
+
log = logging.getLogger(__name__)
+
FORM_DEFAULTS_ADMIN = g.mpuls_config.get('search', 'admin_defaults')[0]
FORM_DEFAULTS_CM = g.mpuls_config.get('search', 'cm_defaults')[0]
+
def get_sort(params):
sort = params.get('sort_field', 'id')
order = params.get('sort_order', 'asc')
@@ -26,7 +29,7 @@
search_options = []
user = session['USER_AUTHORIZED']
- # Searchstring
+ # Searchstring
if options.get('search_str'):
search_options.append(options.get('search_str'))
@@ -35,12 +38,12 @@
for s in options['state']:
search_options.append('state:%s' % s)
- # Responsibilty
+ # Responsibilty
# (shown cases where the user is editor, or standin or both)
if options.get('own'):
- search_options.append('own:%s' % user.id)
+ search_options.append('own:%s' % user.id)
if options.get('standin'):
- search_options.append('standin:%s' % user.id)
+ search_options.append('standin:%s' % user.id)
# Phase
if options.has_key('phase'):
@@ -56,6 +59,7 @@
return search_options
+
class CaseOverviewController(BaseController):
@checkRole(('admin', 'cm', 'pt_dlr'))
@@ -75,8 +79,7 @@
@checkRole(('admin', 'cm', 'pt_dlr'))
def overview(self):
-
- # Set default paramaters for casesearch depending on userrole
+ # Set default paramaters for casesearch depending on userrole
user = session['USER_AUTHORIZED']
if user.isAdmin():
FORM_DEFAULTS = FORM_DEFAULTS_ADMIN
@@ -116,18 +119,18 @@
#count num of cases
c.count_all = len([x for x in c.cases.getDatasets()])
c.count_own = len([x for x in c.cases.getDatasets()
- if x.getEditor().id == user.id])
+ if x.getEditor().id == user.id])
c.count_standin = c.count_all - c.count_own
if h.hasRole(['cm_ka']):
c.count_anon = len([x for x in c.cases.getDatasets()
- if x.getState().getState() in (4,5)])
+ if x.getState().getState() in (4, 5)])
else:
c.count_anon = len([x for x in c.cases.getDatasets()
- if x.getState().getState() == 5])
+ if x.getState().getState() == 5])
c.count_markanon = len([x for x in c.cases.getDatasets()
- if x.getState().getState() == 4])
- c.count_del = len([x for x in c.cases.getDatasets()
- if x.getState().getState() == 3])
+ if x.getState().getState() == 4])
+ c.count_del = len([x for x in c.cases.getDatasets()
+ if x.getState().getState() == 3])
# Load case-selection and merge with default search options
# Ok please close your eyes now!!! This is.... well ugly
@@ -143,8 +146,8 @@
overview = render('/casemanagement/overview.mako')
return formencode.htmlfill.render(overview,
defaults=form_defaults_copy)
-
+
@checkRole(('admin', 'cm', 'pt_dlr'))
def search(self):
log.debug(request.params)
More information about the Mpuls-commits
mailing list