[Mpuls-commits] r2422 - in wasko/branches/2.0: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Apr 20 09:46:49 CEST 2010


Author: roland
Date: 2010-04-20 09:46:47 +0200 (Tue, 20 Apr 2010)
New Revision: 2422

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/controllers/administration.py
Log:
Fixed Wald issue #1392: transfer of cases while deleting user

Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-04-20 06:49:34 UTC (rev 2421)
+++ wasko/branches/2.0/ChangeLog	2010-04-20 07:46:47 UTC (rev 2422)
@@ -1,3 +1,8 @@
+2010-04-20  Roland Geider <roland.geider at intevation.de>
+
+	* mpulsweb/controllers/administration.py:
+	Fixed Wald issue #1392: transfer of cases while deleting user
+
 2010-04-19  Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/public/styles/screen.css:

Modified: wasko/branches/2.0/mpulsweb/controllers/administration.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-04-20 06:49:34 UTC (rev 2421)
+++ wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-04-20 07:46:47 UTC (rev 2422)
@@ -7,7 +7,7 @@
 from pylons.i18n import _
 
 from mpulsweb.lib.db import db
-from mpulsweb.lib.base import BaseController, render
+from mpulsweb.lib.base import BaseController, render, redirect_to
 from mpulsweb.lib.security import checkRole, getDbName
 from mpulsweb.lib.validators import ValidatorStateObject, NewUserGroupForm, \
     EditUserGroupForm , NewUserForm, EditUserForm, DeleteUserHelperForm
@@ -260,34 +260,38 @@
         c.notification_for = DIALOG_CONFIRM_SETEDITOR
         c.form_errors = {}
         c.form_result = {}
-        try:
-            data = formencode.variabledecode.variable_decode(request.params)
-            form_result = validator.to_python(data)
-            case_bundle = MpulsCaseBundle(form_result.get('case_id', []))
-            new_editor = UserObject(form_result.get('editor'))
-            del_user = UserObject(form_result.get('user_id'))
-            all_cases.search('editor:%s;state:1;state:2;state:3;state:4;state:5'
-                             % 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.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
-            if rest > 0:
-                c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD
-                c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS_REST
-                                  % (new_editor.first_name,
-                                     new_editor.last_name,
-                                     del_user.first_name, del_user.last_name))
-            else:
+
+        if 'editor' in request.params:
+            try:
+                data        = formencode.variabledecode.variable_decode(request.params)
+                form_result = validator.to_python(data)
+                case_bundle = MpulsCaseBundle(form_result.get('case_id', []))
+                new_editor  = UserObject(form_result.get('editor'))
+                del_user    = UserObject(form_result.get('user_id'))
+                all_cases.search('editor:%s;state:1;state:2;state:3;state:4;state:5'
+                                % 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.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
-                c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS
-                                  % (new_editor.first_name,
-                                     new_editor.last_name,
-                                     del_user.first_name, del_user.last_name))
-            return render('/administration/dialogs/notificate_delete_user_helper.mako')
-        except formencode.Invalid, error:
-            return self.deleteUser(form_result.get('user_id'), '1')
+                if rest > 0:
+                    c.success_for  = SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD
+                    c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS_REST
+                                    % (new_editor.first_name,
+                                        new_editor.last_name,
+                                        del_user.first_name, del_user.last_name))
+                else:
+                    c.success_for  = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
+                    c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS
+                                    % (new_editor.first_name,
+                                        new_editor.last_name,
+                                        del_user.first_name, del_user.last_name))
+                return render('/administration/dialogs/notificate_delete_user_helper.mako')
+            except formencode.Invalid, error:
+                return self.deleteUser(form_result.get('user_id'), '1')
+        else:
+            redirect_to(controller="/administration", action='overviewUser')
 
     # USERGROUPS
     @checkRole('admin_ka')



More information about the Mpuls-commits mailing list