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

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Tue May 29 12:07:28 CEST 2012


Author: ludwig
Date: 2012-05-29 12:07:28 +0200 (Tue, 29 May 2012)
New Revision: 5967

Modified:
   base/trunk/mpulsweb/controllers/settings.py
Log:
Refactoring: Move Agency generation into a method, so it can easily be
overwritten.


Modified: base/trunk/mpulsweb/controllers/settings.py
===================================================================
--- base/trunk/mpulsweb/controllers/settings.py	2012-05-24 12:05:56 UTC (rev 5966)
+++ base/trunk/mpulsweb/controllers/settings.py	2012-05-29 10:07:28 UTC (rev 5967)
@@ -24,12 +24,12 @@
     def show(self):
         c.form_errors = {}
         c.form_result = {}
-        c.agency = Agency()
+        c.agency = self.get_agency()
         return render('/settings/show.mako')
 
     @checkRole('admin')
     def edit(self):
-        c.agency = Agency()
+        c.agency = self.get_agency()
         c.form_errors = {}
         c.form_result = c.agency.conf
         form = render('/settings/edit.mako')
@@ -41,7 +41,7 @@
     @checkRole('admin')
     def editAction(self):
         validator = EditSettingsForm()
-        c.agency = Agency()
+        c.agency = self.get_agency()
         try:
             c.form_result = validator.to_python(request.params)
         except formencode.Invalid, error:
@@ -59,5 +59,6 @@
         c.url_ok = url(controller='settings', action='index')
         return render ('/settings/dialogs/success_edit.mako')
 
-
+    def get_agency(self):
+        return Agency()
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list