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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 26 16:00:27 CEST 2010


Author: bh
Date: 2010-05-26 16:00:26 +0200 (Wed, 26 May 2010)
New Revision: 2764

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/administration.py
Log:
* mpulsweb/controllers/administration.py
(AdministrationController.editUserAction)
(AdministrationController.resetUserPassword)
(AdministrationController.deleteUser)
(AdministrationController.deleteUserHelper)
(AdministrationController.newUserGroupAction)
(AdministrationController.editUserGroupAction)
(AdministrationController.deleteUserGroup): Use h.url_for
consistently for all-intra application URLs.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-05-26 13:34:22 UTC (rev 2763)
+++ base/trunk/ChangeLog	2010-05-26 14:00:26 UTC (rev 2764)
@@ -1,5 +1,17 @@
 2010-05-26  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/administration.py
+	(AdministrationController.editUserAction)
+	(AdministrationController.resetUserPassword)
+	(AdministrationController.deleteUser)
+	(AdministrationController.deleteUserHelper)
+	(AdministrationController.newUserGroupAction)
+	(AdministrationController.editUserGroupAction)
+	(AdministrationController.deleteUserGroup): Use h.url_for
+	consistently for all-intra application URLs.
+
+2010-05-26  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/templates/auth/logout.mako: Use h.url_for consistently
 	for all-intra application URLs.
 

Modified: base/trunk/mpulsweb/controllers/administration.py
===================================================================
--- base/trunk/mpulsweb/controllers/administration.py	2010-05-26 13:34:22 UTC (rev 2763)
+++ base/trunk/mpulsweb/controllers/administration.py	2010-05-26 14:00:26 UTC (rev 2764)
@@ -8,6 +8,7 @@
 
 from mpulsweb.lib.db import db
 from mpulsweb.lib.base import BaseController, render, redirect_to
+from mpulsweb.lib.helpers import url_for
 from mpulsweb.lib.security import checkRole, getDbName
 from mpulsweb.lib.validators import ValidatorStateObject, NewUserGroupForm, \
     EditUserGroupForm , NewUserForm, EditUserForm, DeleteUserHelperForm
@@ -147,7 +148,8 @@
             c.uo.store()
             c.dialog_title = EDIT_USER_SUCCESS_HEADER
             c.dialog_text = EDIT_USER_SUCCESS_TEXT
-            c.url_ok = "/administration/overviewUser"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUser')
             return render('/administration/dialogs/success_edit_user.mako')
         except formencode.Invalid, error:
             c.form_result = error.value
@@ -168,8 +170,10 @@
             c.dialog_text = "%s %s, %s" % (RESET_PASSWORD_CONFIRM_QUESTION,
                                            c.uo.last_name, c.uo.first_name)
 
-            c.url_yes = "/administration/resetUserPassword/%s/1" % id
-            c.url_no = "/administration/showUser/%s" % id
+            c.url_yes = url_for(controller='/administration',
+                                action='resetUserPassword', id=id, confirmed=1)
+            c.url_no = url_for(controller='/administration',
+                               action='showUser', id=id)
             return render('/administration/dialogs/confirm_resetpassword.mako')
 
     # Old deleteUser method, which does not raise a helper dialog to transfer
@@ -186,7 +190,8 @@
     #    if uo.id == session.get('USER_AUTHORIZED').id:
     #        c.dialog_title = DELETE_SELFUSER_FAILURE
     #        c.dialog_text = DELETE_SELFUSER_FAILURE_TEXT
-    #        c.url_ok = "/administration/overviewUser"
+    #        c.url_ok = url_for(controller='/administration',
+    #                           action='overviewUser')
     #        return render('/administration/dialogs/failed_delete_user.mako')
 
     #    if confirmed:
@@ -195,13 +200,15 @@
     #        if user_has_cases(uo):
     #            c.dialog_title = DELETE_USER_HASCASES
     #            c.dialog_text = DELETE_USER_HASCASES_TEXT
-    #            c.url_ok = "/administration/overviewUser"
+    #            c.url_ok = url_for(controller='/administration',
+    #                               action='overviewUser')
     #            return render('/administration/dialogs/failed_delete_user.mako')
     #        else:
     #            uo.delete()
     #            c.dialog_title = DELETE_USER_SUCCESS_HEADER
     #            c.dialog_text = DELETE_USER_SUCCESS_TEXT
-    #            c.url_ok = "/administration/overviewUser"
+    #            c.url_ok = url_for(controller='/administration',
+    #                               action='overviewUser')
     #            return render('/administration/dialogs/success_delete_user.mako')
 
     #    else:
@@ -210,8 +217,10 @@
     #        c.dialog_text = DELETE_USER_CONFIRM_QUESTION % (uo.last_name,
     #                                                     uo.first_name,
     #                                                     uo.login)
-    #        c.url_yes = "/administration/deleteUser/%s/1" % id
-    #        c.url_no = "/administration/overviewUser/"
+    #        c.url_yes = url_for(controller='/administration',
+    #                            action='deleteUser', id=id, confirmed=1)
+    #        c.url_no = url_for(controller='/administration',
+    #                           action='overviewUser')
     #        return render('/administration/dialogs/confirm_deleteuser.mako')
 
     @checkRole('admin')
@@ -223,7 +232,8 @@
         if uo.id == session.get('USER_AUTHORIZED').id:
             c.failed_for = DELETE_SELFUSER_FAILURE
             c.failed_text = DELETE_SELFUSER_FAILURE_TEXT
-            c.url_ok = "/administration/overviewUser"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUser')
             return render('/administration/dialogs/failed_delete_user.mako')
 
         if confirmed:
@@ -249,7 +259,8 @@
                 uo.delete()
                 c.success_for = DELETE_USER_SUCCESS_HEADER
                 c.success_text = DELETE_USER_SUCCESS_TEXT
-                c.url_ok = "/administration/overviewUser"
+                c.url_ok = url_for(controller='/administration',
+                                   action='overviewUser')
                 return render('/administration/dialogs/success_delete_user.mako')
 
         else:
@@ -258,8 +269,10 @@
             c.question = DELETE_USER_CONFIRM_QUESTION % (uo.last_name,
                                                          uo.first_name,
                                                          uo.login)
-            c.url_yes = "/administration/deleteUser/%s/1" % id
-            c.url_no = "/administration/overviewUser/"
+            c.url_yes = url_for(controller='/administration',
+                                action='deleteUser', id=id, confirmed=1)
+            c.url_no = url_for(controller='/administration',
+                               action='overviewUser')
             return render('/administration/dialogs/confirm_deleteuser.mako')
 
     @checkRole('admin')
@@ -281,8 +294,9 @@
                                 % del_user.id)
                 num  = case_bundle.setEditor(form_result.get('editor'))
                 rest = all_cases.numDatasets() - case_bundle.numDatasets()
-                c.url_ok = ("/administration/deleteUser/%s/1"
-                            % form_result.get('user_id'))
+                c.url_ok = url_for(controller='/administration',
+                                   action='deleteUser',
+                                   id=form_result.get('user_id'), confirmed=1)
                 c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
                 if rest > 0:
                     c.success_for  = SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD
@@ -328,7 +342,8 @@
             c.ugo = factory.create(c.form_result.get('name'))
             c.dialog_title = NEW_USERGROUP_SUCCESS_HEADER
             c.dialog_text = NEW_USERGROUP_SUCCESS_TEXT
-            c.url_ok = "/administration/overviewUserGroups"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUserGroups')
             return render('/administration/dialogs/success_new_usergroup.mako')
         except formencode.Invalid, error:
             c.form_result = error.value
@@ -342,7 +357,8 @@
             log.exception(e)
             c.dialog_title = NEW_USERGROUP_FAILURE_HEADER
             c.dialog_text = NEW_USERGOUP_FAILURE_TEXT
-            c.url_ok = "/administration/overviewUserGroups"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUserGroups')
             return render('/administration/dialogs/failed_new_usergroup.mako')
 
     @checkRole('admin_ka')
@@ -395,7 +411,8 @@
             c.group = group
             c.dialog_title = EDIT_USERGROUP_SUCCESS_HEADER
             c.dialog_text = EDIT_USERGROUP_SUCCESS_TEXT
-            c.url_ok = "/administration/overviewUserGroups"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUserGroups')
             return render('/administration/dialogs/success_edit_usergroup.mako')
         except formencode.Invalid, error:
             c.form_result = error.value
@@ -418,20 +435,25 @@
                 ugo.delete()
                 c.dialog_title = DELETE_USERGROUP_SUCCESS_HEADER
                 c.dialog_text = DELETE_USERGROUP_SUCCESS_TEXT
-                c.url_ok = "/administration/overviewUserGroups"
+                c.url_ok = url_for(controller='/administration',
+                                   action='overviewUserGroups')
                 return render('/administration/dialogs/success_deletegroup_user.mako')
             else:
                 c.context = "../main.mako"
                 c.dialog_title = DELETE_USERGROUP_CONFIRM
                 c.dialog_text = DELETE_USERGROUP_CONFIRM_QUESTION
-                c.url_yes = "/administration/deleteUserGroup/%s/1" % ugo.id
-                c.url_no = "/administration/overviewUserGroups/"
+                c.url_yes = url_for(controller='/administration',
+                                    action='deleteUserGroup', id=ugo.id,
+                                    confirmed=1)
+                c.url_no = url_for(controller='/administration',
+                                   action='overviewUserGroups')
                 return render('/administration/dialogs/confirm_deleteusergroup.mako')
         except Exception, e:
             log.exception(e)
             c.dialog_title = DELETE_USERGROUP_FAILED_HEADER
             c.dialog_text = DELETE_USERGROUP_FAILED_TEXT
-            c.url_ok = "/administration/overviewUserGroups"
+            c.url_ok = url_for(controller='/administration',
+                               action='overviewUserGroups')
             return render('/administration/dialogs/failed_new_usergroup.mako')
 
 



More information about the Mpuls-commits mailing list