[Mpuls-commits] r1394 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 9 15:52:19 CET 2010
Author: torsten
Date: 2010-02-09 15:52:17 +0100 (Tue, 09 Feb 2010)
New Revision: 1394
Added:
wasko/branches/2.0/mpulsweb/controllers/settings.py
Log:
* mpulsweb/controllers/settings.py: New. Copied agencysetting methods
from waskaweb administration controller.
Added: wasko/branches/2.0/mpulsweb/controllers/settings.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/settings.py 2010-02-09 14:30:42 UTC (rev 1393)
+++ wasko/branches/2.0/mpulsweb/controllers/settings.py 2010-02-09 14:52:17 UTC (rev 1394)
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+import logging
+import formencode
+
+from pylons import request, response, session, tmpl_context as c
+from pylons.i18n import _
+from pylons.controllers.util import abort, redirect_to
+
+from mpulsweb.lib.base import BaseController, render
+from mpulsweb.lib.security import checkRole
+from mpulsweb.model.agencysettings import Agency
+
+log = logging.getLogger(__name__)
+
+class SettingsController(BaseController):
+
+ @checkRole('admin_ka')
+ def index(self):
+ c.form_errors = {}
+ c.form_result = {}
+ c.agency = Agency()
+ return render('administration/show_settings.mako')
+
+ @checkRole('admin_ka')
+ def editSettings(self):
+ c.form_errors = {}
+ c.form_result = {}
+ c.agency = Agency()
+ return render('administration/edit_settings.mako')
+
+ @checkRole('admin_ka')
+ def editSettingsAction(self):
+ validator = EditSettingsForm()
+ c.agency = Agency()
+ try:
+ c.form_result = validator.to_python(request.params)
+ except formencode.Invalid, error:
+ c.form_result = error.value
+ c.form_errors = error.error_dict or {}
+ return render('/administration/edit_settings.mako')
+
+ c.agency.store(c.form_result)
+ c.success_for = EDIT_AGENCY_SUCCESS_HEADER
+ c.success_text = EDIT_AGENCY_SUCCESS_TEXT
+ c.url_ok = "/administration/showSettings"
+ return render ('/administration/dialogs/success_edit_agency.mako')
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Mpuls-commits
mailing list