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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 23 14:24:04 CET 2010


Author: torsten
Date: 2010-03-23 14:24:04 +0100 (Tue, 23 Mar 2010)
New Revision: 2077

Modified:
   wasko/branches/2.0/mpulsweb/controllers/appointment.py
   wasko/branches/2.0/mpulsweb/controllers/caseappointment.py
Log:
Removed possoible dialog if deleting of an appointment fails. If this happens
it is worth to throw an exception.


Modified: wasko/branches/2.0/mpulsweb/controllers/appointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/appointment.py	2010-03-23 13:22:15 UTC (rev 2076)
+++ wasko/branches/2.0/mpulsweb/controllers/appointment.py	2010-03-23 13:24:04 UTC (rev 2077)
@@ -52,12 +52,6 @@
 Der Termin wurde erfolgreich gelöscht. Klicken Sie auf 'OK', um zur
 Terminübersicht zu gelangen."""
 
-DELETE_APPOINT_NOTIFICATION_FAILED = u'Termin nicht gelöscht'
-DELETE_APPOINT_NOTIFICATION_TEXT_FAILED = u"""\
-Bei dem Löschen des Termins ist einer Fehler aufgetreten.  Der Termin
-wurde nicht gelöscht. Klicken Sie auf 'OK', um zur Terminübersicht zu
-gelangen."""
-
 CREATE_APPOINT_NOTIFICATION_SUCCESS = u"""Termin erstellt"""
 CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
 Der Termin wurde erfolgreich erstellt. Klicken Sie auf 'OK', um zur
@@ -182,16 +176,11 @@
         factory = GlobalAppointmentFactory()
         if confirmed == 1:
             appointment = factory.loadById(id)
-            if appointment.delete():
-                c.dialog_title = DELETE_APPOINT_NOTIFICATION_SUCCESS
-                c.dialog_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/success_delete_appointment.mako')
-            else:
-                c.dialog_title = DELETE_APPOINT_NOTIFICATION_FAILED
-                c.dialog_text = DELETE_APPOINT_NOTIFICATION_TEXT_FAILED
-                c.url_ok = "/appointment/overview"
-                return render('/appointments/dialogs/failed_delete_appointment.mako')
+            appointment.delete()
+            c.dialog_title = DELETE_APPOINT_NOTIFICATION_SUCCESS
+            c.dialog_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
+            c.url_ok = "/appointment/overview"
+            return render('/appointments/dialogs/success_delete_appointment.mako')
         else:
             c.context = "../main.mako"
             c.dialog_title = DELETE_APPOINT_CONFIRM

Modified: wasko/branches/2.0/mpulsweb/controllers/caseappointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/caseappointment.py	2010-03-23 13:22:15 UTC (rev 2076)
+++ wasko/branches/2.0/mpulsweb/controllers/caseappointment.py	2010-03-23 13:24:04 UTC (rev 2077)
@@ -15,9 +15,7 @@
      CaseAppointmentFactory, CaseReminderOverview
 from mpulsweb.controllers.appointment import \
      DELETE_APPOINT_NOTIFICATION_SUCCESS, \
-     DELETE_APPOINT_NOTIFICATION_FAILED, \
      DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS, \
-     DELETE_APPOINT_NOTIFICATION_TEXT_FAILED, \
      DELETE_APPOINT_CONFIRM, \
      DELETE_APPOINT_CONFIRM_TEXT, \
      CREATE_APPOINT_NOTIFICATION_SUCCESS, \
@@ -180,16 +178,11 @@
         factory = CaseAppointmentFactory()
         appointment = factory.loadById(id)
         if confirmed == 1:
-            if appointment.delete():
-                c.success_for = DELETE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok = "/caseappointment/index/%s" % appointment.case_id
-                return render('/casemanagement/dialogs/success_delete_appointment.mako')
-            else:
-                c.failed_for = DELETE_APPOINT_NOTIFICATION_FAILED
-                c.failed_text = DELETE_APPOINT_NOTIFICATION_TEXT_FAILED
-                c.url_ok = "/case/appointments/%s" % appointment.case_id
-                return render('/casemanagement/dialogs/failed_delete_appointment.mako')
+            appointment.delete()
+            c.success_for = DELETE_APPOINT_NOTIFICATION_SUCCESS
+            c.success_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
+            c.url_ok = "/caseappointment/index/%s" % appointment.case_id
+            return render('/casemanagement/dialogs/success_delete_appointment.mako')
         else:
             c.context = "../main.mako"
             c.confirm_for = DELETE_APPOINT_CONFIRM



More information about the Mpuls-commits mailing list