[Mpuls-commits] r2170 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 25 12:42:59 CET 2010


Author: torsten
Date: 2010-03-25 12:42:59 +0100 (Thu, 25 Mar 2010)
New Revision: 2170

Modified:
   wasko/branches/2.0/mpulsweb/controllers/appointment.py
Log:
* mpulsweb/controllers/appointment.py
	(AppointmentController.createAction): Do not render trace.mako on
	exception
	* mpulsweb/controllers/appointment.py
	(AppointmentController.editAction): Do not render trace.mako on
	exception


Modified: wasko/branches/2.0/mpulsweb/controllers/appointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/appointment.py	2010-03-25 11:41:00 UTC (rev 2169)
+++ wasko/branches/2.0/mpulsweb/controllers/appointment.py	2010-03-25 11:42:59 UTC (rev 2170)
@@ -93,26 +93,23 @@
         c.form_errors = {}
         c.form_result = {}
         try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Create appointment
-                appointment = factory.createNew()
-                appointment.setData(form_result)
-                appointment.store()
-                c.dialog_title = CREATE_APPOINT_NOTIFICATION_SUCCESS
-                c.dialog_text = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_create_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                form = render('/appointments/new.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                                  defaults=c.form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=c.form_errors)
-        except:
-            return render('/tests/trace.mako')
+            form_result = validator.to_python(request.params)
+            # Create appointment
+            appointment = factory.createNew()
+            appointment.setData(form_result)
+            appointment.store()
+            c.dialog_title = CREATE_APPOINT_NOTIFICATION_SUCCESS
+            c.dialog_text = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
+            c.url_ok = "/appointment/overview"
+            return render('/appointments/dialogs/success_create_appointment.mako')
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            form = render('/appointments/new.mako')
+            return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                              defaults=c.form_result,
+                                              auto_insert_errors=False,
+                                              errors=c.form_errors)
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
     def show(self, id):
@@ -148,26 +145,23 @@
         c.form_errors = {}
         c.form_result = {}
         try:
-            try:
-                form_result = validator.to_python(request.params)
-                # Load appointment and set data
-                appointment = factory.loadById(form_result.get('id'))
-                appointment.setData(form_result)
-                appointment.store()
-                c.dialog_title = EDIT_APPOINT_NOTIFICATION_SUCCESS
-                c.dialog_text = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_edit_appointment.mako')
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                form = render('/appointments/edit.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'),
-                                                  defaults=c.form_result,
-                                                  auto_insert_errors=False,
-                                                  errors=c.form_errors)
-        except:
-            return render('/tests/trace.mako')
+            form_result = validator.to_python(request.params)
+            # Load appointment and set data
+            appointment = factory.loadById(form_result.get('id'))
+            appointment.setData(form_result)
+            appointment.store()
+            c.dialog_title = EDIT_APPOINT_NOTIFICATION_SUCCESS
+            c.dialog_text = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
+            c.url_ok = "/appointment/overview"
+            return render('/appointments/dialogs/success_edit_appointment.mako')
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            form = render('/appointments/edit.mako')
+            return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                              defaults=c.form_result,
+                                              auto_insert_errors=False,
+                                              errors=c.form_errors)
 
     @checkRole(('admin_ka'))
     def delete(self, id, confirmed=False):



More information about the Mpuls-commits mailing list