[Mpuls-commits] r2380 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 15 16:18:06 CEST 2010
Author: torsten
Date: 2010-04-15 16:18:04 +0200 (Thu, 15 Apr 2010)
New Revision: 2380
Modified:
wasko/branches/2.0/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py (FormularpageController.save):
After saving the data check if user clicked an adding or delete rg. If
so redirect user to the rg-controller.
Modified: wasko/branches/2.0/mpulsweb/controllers/formularpage.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/formularpage.py 2010-04-15 14:17:30 UTC (rev 2379)
+++ wasko/branches/2.0/mpulsweb/controllers/formularpage.py 2010-04-15 14:18:04 UTC (rev 2380)
@@ -8,9 +8,9 @@
import formencode
from pylons import request, session, c
-from pylons import g
+from pylons import g, h
from pylons.i18n import _
-from pylons.controllers.util import abort
+from pylons.controllers.util import abort, redirect
from formed.instance.backends.postgres import DBFactory as InstanceFactory
from formed.instance.tree import SetDataException, RepeatInstanceContainerNode
@@ -42,7 +42,15 @@
result = {}
for i in params:
# libformed
- if i not in ['save', 'savenext', 'page']:
+ if i not in ['save',
+ 'savenext',
+ 'page',
+ 'add_rg',
+ 'add_rg.y',
+ 'add_rg.x',
+ 'del_rg',
+ 'del_rg.y',
+ 'del_rg.x']:
result[i] = params[i]
return result
@@ -171,9 +179,16 @@
instance_tree.setData(form_result)
session['uncommited_fields'] = instance_tree.commit()
session.save()
- #ok_status(_('Successfully saved data'))
- # show next page after saving?
- if request.params.has_key('savenext'):
+ # How to proceed after saving the data?
+ if request.params.has_key('add_rg'):
+ redirect(h.url(controller='repeatgroup',
+ action="new",
+ id=request.params.get('add_rg')))
+ elif request.params.has_key('del_rg'):
+ redirect(h.url(controller='repeatgroup',
+ action="delete",
+ id=request.params.get('del_rg')))
+ elif request.params.has_key('savenext'):
page_id = session['navigation.tree'].getTreeItem(page_id).nextKey().key
except SetDataException, err:
More information about the Mpuls-commits
mailing list