[Mpuls-commits] r4908 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Apr 15 10:15:23 CEST 2011


Author: torsten
Date: 2011-04-15 10:15:21 +0200 (Fri, 15 Apr 2011)
New Revision: 4908

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case.py
Log:
Added new function _add_custom_fields to add specific data to a new created
case.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-04-14 13:43:07 UTC (rev 4907)
+++ base/trunk/ChangeLog	2011-04-15 08:15:21 UTC (rev 4908)
@@ -1,3 +1,12 @@
+2011-04-15  Torsten Irlaender <torsten at intevation.de>
+
+	* mpulsweb/controllers/case.py (_add_custom_fields): New function.
+	This function should be overwritten in specific applications to add
+	customs data to the new created case like agency name oder agency
+	number. 
+	* mpulsweb/controllers/case.py (newAction): Call _add_custom_fields to
+	add custom fields when creating a new case.
+
 2011-04-11  Torsten Irlaender <torsten at intevation.de>
 
 	* mpulsweb/public/styles/all.css: Added ".invisible" classe to set

Modified: base/trunk/mpulsweb/controllers/case.py
===================================================================
--- base/trunk/mpulsweb/controllers/case.py	2011-04-14 13:43:07 UTC (rev 4907)
+++ base/trunk/mpulsweb/controllers/case.py	2011-04-15 08:15:21 UTC (rev 4908)
@@ -355,6 +355,12 @@
         c.case = session.get('case')
         return render('/casemanagement/new.mako')
 
+    def _add_custom_fields(self):
+        '''This function should be overwritten in specific applications to add
+        custom fields like agencyname, and fkz to a new created case. On
+        default this function returns an empty dictionary.'''
+        return {}
+
     @checkRole('cm_ka')
     def newAction(self):
         # TODO: Use htmlfill here!
@@ -376,6 +382,9 @@
             validator = NewCaseForm()
             try:
                 form_result = validator.to_python(request.params)
+                # Add custom fields to the form_result which are not part of
+                # the new case formular
+                form_result.update(self._add_custom_fields())
                 # Create a new case
                 case = self._createCase(form_result)
             except formencode.Invalid, error:



More information about the Mpuls-commits mailing list