[Mpuls-commits] r2168 - wasko/branches/2.0/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Mar 25 12:39:20 CET 2010
Author: torsten
Date: 2010-03-25 12:39:20 +0100 (Thu, 25 Mar 2010)
New Revision: 2168
Modified:
wasko/branches/2.0/mpulsweb/controllers/administration.py
Log:
* mpulsweb/controllers/administration.py
(AdministrationController.deleteUser): Do not render trace.mako on
exception.
Modified: wasko/branches/2.0/mpulsweb/controllers/administration.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/administration.py 2010-03-25 11:35:00 UTC (rev 2167)
+++ wasko/branches/2.0/mpulsweb/controllers/administration.py 2010-03-25 11:39:20 UTC (rev 2168)
@@ -202,52 +202,49 @@
def deleteUser(self, id, confirmed='0'):
id = self._checkInt(id)
confirmed = self._checkBool(confirmed)
- try:
- uo = UserObject(id)
- # Make sure that the user can not delete himself
- 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"
- return render('/administration/dialogs/failed_delete_user.mako')
+ uo = UserObject(id)
+ # Make sure that the user can not delete himself
+ 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"
+ return render('/administration/dialogs/failed_delete_user.mako')
- if confirmed:
- # Check if there are cases for which the user is the editor. If
- # he is an editor then raise a dialog which allows the user to
- # transfer the cases.
- overview = MpulsCaseOverview()
- overview.search('editor:%s;'
- 'state:1;state:2;state:3;state:4;state:5'
- % uo.id)
- if overview.getDatasets():
- list = UserListObject()
- filter = [u.id for u in list.getAdminList()]
- filter.append(uo.id) #the user we want to delete
- c.user_list = list.getUserList(filter)
- c.cases = overview
- c.delete_user_id = id
- return render('/administration/delete_user_helper.mako')
- else:
- uo.delete()
- c.notification_for = DELETE_USER_NOTIFICATION_SUCCESS
- c.notification_text = DELETE_USER_NOTIFICATION_TEXT_SUCCESS
- c.success_for = DELETE_USER_SUCCESS_HEADER
- c.success_text = DELETE_USER_SUCCESS_TEXT
- c.url_ok = "/administration/overviewUser"
- return render('/administration/dialogs/success_delete_user.mako')
-
+ if confirmed:
+ # Check if there are cases for which the user is the editor. If
+ # he is an editor then raise a dialog which allows the user to
+ # transfer the cases.
+ overview = MpulsCaseOverview()
+ overview.search('editor:%s;'
+ 'state:1;state:2;state:3;state:4;state:5'
+ % uo.id)
+ if overview.getDatasets():
+ list = UserListObject()
+ filter = [u.id for u in list.getAdminList()]
+ filter.append(uo.id) #the user we want to delete
+ c.user_list = list.getUserList(filter)
+ c.cases = overview
+ c.delete_user_id = id
+ return render('/administration/delete_user_helper.mako')
else:
- c.context = "../main.mako"
- c.confirm_for = DELETE_USER_CONFIRM
- 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/"
- return render('/administration/dialogs/confirm_deleteuser.mako')
- except:
- return render('/tests/trace.mako')
+ uo.delete()
+ c.notification_for = DELETE_USER_NOTIFICATION_SUCCESS
+ c.notification_text = DELETE_USER_NOTIFICATION_TEXT_SUCCESS
+ c.success_for = DELETE_USER_SUCCESS_HEADER
+ c.success_text = DELETE_USER_SUCCESS_TEXT
+ c.url_ok = "/administration/overviewUser"
+ return render('/administration/dialogs/success_delete_user.mako')
+ else:
+ c.context = "../main.mako"
+ c.confirm_for = DELETE_USER_CONFIRM
+ 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/"
+ return render('/administration/dialogs/confirm_deleteuser.mako')
+
@checkRole('admin')
def deleteUserHelper(self):
validator = DeleteUserHelperForm()
More information about the Mpuls-commits
mailing list