[Mpuls-commits] r5628 - base/trunk/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 18 23:02:37 CET 2011


Author: bh
Date: 2011-11-18 23:02:33 +0100 (Fri, 18 Nov 2011)
New Revision: 5628

Modified:
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
Check access permissions in FormularpageController.save
by using the _load_current_case method to load the case and using the
new method _render_page to render the page instead of going through the
select method.

This means that the same instance tree is used for saving the changes
and rendering the form again with the new values. This requires
libformed revision 572:ff739579cf4f.

Implements the access checks for switching the form to edit mode for
mpuls/issue2367.


Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2011-11-18 21:16:35 UTC (rev 5627)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2011-11-18 22:02:33 UTC (rev 5628)
@@ -150,11 +150,10 @@
 
     @checkRole(('cm'))
     def save(self):
-        case_id = session['case'].id
-        factory = InstanceFactory(g.formedTree, PostgresDBInterface())
-        instance_tree = factory.loadInstanceTreeByIdentifier(
-            case_id,
-            session.get('uncommited_fields'))
+        case = self._load_current_case()
+        case_id = case.id
+        instance_tree = case.get_formed_instance_tree()
+
         page_id = request.params['page']
 
         form_result = convert2dic(request.params)
@@ -196,7 +195,7 @@
         if phase_changed:
             return phase_changed
 
-        return self.select(page_id)
+        return self._render_page(case, page_id)
 
     def _before_set_data_hook(self, case_id, form_result):
         """Modify the form_result dict of the save method before it's applied.



More information about the Mpuls-commits mailing list