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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 26 17:43:40 CEST 2010


Author: bh
Date: 2010-05-26 17:43:38 +0200 (Wed, 26 May 2010)
New Revision: 2772

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/logbook.py
Log:
* mpulsweb/controllers/logbook.py (LogbookController.show)
(LogbookController.newAction, LogbookController.edit)
(LogbookController.editAction, LogbookController.delete): Use
h.url_for consistently for all-intra application URLs.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-05-26 15:18:08 UTC (rev 2771)
+++ base/trunk/ChangeLog	2010-05-26 15:43:38 UTC (rev 2772)
@@ -1,5 +1,12 @@
 2010-05-26  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/logbook.py (LogbookController.show)
+	(LogbookController.newAction, LogbookController.edit)
+	(LogbookController.editAction, LogbookController.delete): Use
+	h.url_for consistently for all-intra application URLs.
+
+2010-05-26  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/document.py
 	(DocumentController.globalDelete): Use h.url_for consistently for
 	all-intra application URLs.

Modified: base/trunk/mpulsweb/controllers/logbook.py
===================================================================
--- base/trunk/mpulsweb/controllers/logbook.py	2010-05-26 15:18:08 UTC (rev 2771)
+++ base/trunk/mpulsweb/controllers/logbook.py	2010-05-26 15:43:38 UTC (rev 2772)
@@ -34,6 +34,7 @@
 from mpulsweb.lib.security import checkRole
 from mpulsweb.model.logbook import Logbook, LogbookEntry, LogbookEntryChecker
 
+from mpulsweb.lib.helpers import url_for
 from mpulsweb.lib.base import BaseController, c, render, request, session
 from mpulsweb.lib.validators import CreateLogbookForm, EditLogbookForm
 
@@ -97,7 +98,8 @@
         except Exception, e:
             c.failed_for = LOGBOOK_ENTRY_SHOW_FAILED
             c.failed_text = LOGBOOK_ENTRY_SHOW_FAILED_TEXT
-            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             log.exception(e)
             return render('/logbook/dialogs/failed_show_logbook_entry.mako')
 
@@ -154,7 +156,8 @@
             logbook = Logbook(checker.getCaseId())
             logbook.addEntry(checker.getLogbookEntry())
             logbook.store(session['USER_AUTHORIZED'].id)
-            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             c.success_for = CREATE_LOGBOOK_ENTRY_SUCCESS
             c.success_text = CREATE_LOGBOOK_ENTRY_SUCCESS_TEXT
             return render('/logbook/dialogs/success_create_logbook_entry.mako')
@@ -162,7 +165,8 @@
             traceback.print_exc(file=sys.stderr)
             c.failed_for = LOGBOOK_ENTRY_CREATE_FAILED
             c.failed_text = LOGBOOK_ENTRY_CREATE_FAILED_TEXT
-            c.url_ok = "/case/logbook/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/case', action='logbook',
+                               id=session['case'].id)
             return render('/logbook/dialogs/failed_create_logbook_entry.mako')
 
     @checkRole('cm_ka')
@@ -190,7 +194,8 @@
             log.exception(e)
             c.failed_for = LOGBOOK_ENTRY_SHOW_FAILED
             c.failed_text = LOGBOOK_ENTRY_SHOW_FAILED_TEXT
-            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             return render('/logbook/dialogs/failed_show_logbook_entry.mako')
 
     @checkRole('cm_ka')
@@ -223,13 +228,15 @@
             entry.storeForUser(session['USER_AUTHORIZED'].id)
             c.success_for = LOGBOOK_ENTRY_SAVE_SUCCESS
             c.success_text = LOGBOOK_ENTRY_SAVE_SUCCESS_TEXT
-            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             return render('/logbook/dialogs/success_save_logbook_entry.mako')
         except Exception, e:
             log.exception(e)
             c.failed_for = LOGBOOK_ENTRY_SAVE_FAILED
             c.failed_text = LOGBOOK_ENTRY_SAVE_FAILED_TEXT
-            c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+            c.url_ok = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             return render('/logbook/dialogs/failed_save_logbook_entry.mako')
 
     @checkRole('cm_ka')
@@ -241,19 +248,23 @@
                 Logbook().deleteEntryById(int(id))
                 c.success_for = LOGBOOK_ENTRY_DELETE_SUCCESS
                 c.success_text = LOGBOOK_ENTRY_DELETE_SUCCESS_TEXT
-                c.url_ok = "/case/logbook/%s" % str(session['case'].id)
+                c.url_ok = url_for(controller='/case', action='logbook',
+                                   id=session['case'].id)
                 return render('/logbook/dialogs/success_delete_logbook_entry.mako')
             except Exception, e:
                 log.exception(e)
                 c.failed_for = LOGBOOK_ENTRY_DELETE_FAILED
                 c.failed_text = LOGBOOK_ENTRY_DELETE_FAILED_TEXT
-                c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+                c.url_ok = url_for(controller='/logbook', action='index',
+                                   id=session['case'].id)
                 return render('/logbook/dialogs/failed_delete_logbook_entry.mako')
         else:
             c.confirm_for = DELETE_LOGBOOK_ENTRY_CONFIRM
             c.question = DELETE_LOGBOOK_ENTRY_CONFIRM_TEXT
-            c.url_yes = "/logbook/delete/%s/1" % id
-            c.url_no = "/logbook/index/%s" % session['case'].id
+            c.url_yes = url_for(controller='/logbook', action='delete', id=id,
+                                confirmed=1)
+            c.url_no = url_for(controller='/logbook', action='index',
+                               id=session['case'].id)
             return render('/logbook/dialogs/confirm_delete_logbook_entry.mako')
 
     @checkRole(('cm_ka'))



More information about the Mpuls-commits mailing list