[Mpuls-commits] r5615 - base/trunk/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Nov 18 20:26:08 CET 2011
Author: bh
Date: 2011-11-18 20:26:01 +0100 (Fri, 18 Nov 2011)
New Revision: 5615
Modified:
base/trunk/mpulsweb/controllers/meta.py
Log:
Do not require editability in the meta controller where appropriate.
This change only covers places where the _loadCase method is called. In
the meta controller, this means the actions index, print_statement1 and
print_statement2.
The actions digest and download might seem to be read only at a first
glance, but if the download from the meta server failes because the meta
case is gone, they modify the meta settings of the case, and thus should
probably be considered as modifying the case. This commit adds comments
that explain this.
Implements part of the access restrictions for mpuls/issue2367.
Modified: base/trunk/mpulsweb/controllers/meta.py
===================================================================
--- base/trunk/mpulsweb/controllers/meta.py 2011-11-18 18:57:19 UTC (rev 5614)
+++ base/trunk/mpulsweb/controllers/meta.py 2011-11-18 19:26:01 UTC (rev 5615)
@@ -69,7 +69,7 @@
session['meta_discretion_statement'] = False
session['meta_acceptance_statement'] = False
session.save()
- c.case = self._loadCase(id)
+ c.case = self._loadCase(id, read_only=True)
c.meta = c.case.getMeta()
c.agency = Agency()
return render('/meta/index.mako')
@@ -78,7 +78,7 @@
def print_statement1(self, id):
'''Returns a rendered statement of the agreement statement to
sychronize data with the meta case'''
- c.case = self._loadCase(id)
+ c.case = self._loadCase(id, read_only=True)
c.agency = Agency()
return render('/meta/statement1.mako')
@@ -100,7 +100,7 @@
def print_statement2(self, id):
'''Returns a rendered statement of the agreement statement to
sychronize data with the meta case'''
- c.case = self._loadCase(id)
+ c.case = self._loadCase(id, read_only=True)
c.agency = Agency()
return render('/meta/statement2.mako')
@@ -394,6 +394,9 @@
def digest(self, id):
'''Will return the digest part of the meta case html'''
+ # Do not call _loadCase with read_only=True here. Downloading
+ # the meta case digest may end up modifying the meta settings if
+ # he meta case has been deleted.
meta = self._loadCase(id).getMeta()
sneedle = "<!-- START CASE BODY -->"
eneedle = "<!-- END CASE BODY -->"
@@ -405,6 +408,9 @@
def download(self, id):
'''Will return the body the full meta case html'''
+ # Do not call _loadCase with read_only=True here. Downloading
+ # the meta case may end up modifying the meta settings if he
+ # meta case has been deleted.
meta = self._loadCase(id).getMeta()
sneedle = "<!-- START CASE BODY -->"
eneedle = "<!-- END CASE BODY -->"
More information about the Mpuls-commits
mailing list