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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 25 12:41:01 CET 2010


Author: torsten
Date: 2010-03-25 12:41:00 +0100 (Thu, 25 Mar 2010)
New Revision: 2169

Modified:
   wasko/branches/2.0/mpulsweb/controllers/usersettings.py
Log:
* mpulsweb/controllers/usersettings.py
	(UsersettingsController.changePasswordAction): Do not render
	trace.mako on exception.
	* mpulsweb/controllers/usersettings.py
	(UsersettingsController.changePasswordOnLoginAction): Do not render
	trace.mako on exception.


Modified: wasko/branches/2.0/mpulsweb/controllers/usersettings.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/usersettings.py	2010-03-25 11:39:20 UTC (rev 2168)
+++ wasko/branches/2.0/mpulsweb/controllers/usersettings.py	2010-03-25 11:41:00 UTC (rev 2169)
@@ -79,29 +79,26 @@
     def changePasswordAction(self):
         validator = NewPasswordForm()
         try:
-            try:
-                uid = request.params['uid']
-                c.uo = UserObject(uid)
-                form_result = validator.to_python(request.params)
-                new_pass = c.uo.setPassword(form_result.get('passwd'))
-                if new_pass:
-                    # Save new password in the session
-                    user = session['USER_AUTHORIZED']
-                    user.password = new_pass
-                    session['USER_AUTHORIZED'] = user
-                    session.save()
-                    c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
-                    c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
-                    c.url_ok = h.url_for(controller="usersettings",
-                                         action="showSettings", id=user.id)
-                else:
-                    return "Password could not be changed"
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                return render('/usersettings/change_password.mako')
-        except:
-            return render('/tests/trace.mako')
+            uid = request.params['uid']
+            c.uo = UserObject(uid)
+            form_result = validator.to_python(request.params)
+            new_pass = c.uo.setPassword(form_result.get('passwd'))
+            if new_pass:
+                # Save new password in the session
+                user = session['USER_AUTHORIZED']
+                user.password = new_pass
+                session['USER_AUTHORIZED'] = user
+                session.save()
+                c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
+                c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
+                c.url_ok = h.url_for(controller="usersettings",
+                                     action="showSettings", id=user.id)
+            else:
+                return "Password could not be changed"
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            return render('/usersettings/change_password.mako')
         return render('/usersettings/dialogs/notificate_setpassword.mako')
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr', 'pb_ka'))
@@ -116,30 +113,27 @@
         # action succseeds
         validator = NewPasswordForm()
         try:
-            try:
-                form_result = validator.to_python(request.params)
-                uo = UserObject(form_result.get('uid'))
-                new_pass = uo.setPassword(form_result.get('passwd'))
-                if new_pass:
-                    # Save new password in the session
-                    session_user = session['USER_AUTHORIZED']
-                    session_user.password = new_pass
-                    session_user.needs_passrefresh = False
-                    session['USER_AUTHORIZED'] = session_user
-                    session.save()
-                    c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
-                    c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
-                    c.url_ok = h.url_for(controller="usersettings",
-                                         action="showSettings",
-                                         id=session_user.id)
-                else:
-                    return "Password could not be changed"
-            except formencode.Invalid, error:
-                c.form_result = error.value
-                c.form_errors = error.error_dict or {}
-                return render('/usersettings/change_password_login.mako')
-        except:
-            return render('/tests/trace.mako')
+            form_result = validator.to_python(request.params)
+            uo = UserObject(form_result.get('uid'))
+            new_pass = uo.setPassword(form_result.get('passwd'))
+            if new_pass:
+                # Save new password in the session
+                session_user = session['USER_AUTHORIZED']
+                session_user.password = new_pass
+                session_user.needs_passrefresh = False
+                session['USER_AUTHORIZED'] = session_user
+                session.save()
+                c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
+                c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
+                c.url_ok = h.url_for(controller="usersettings",
+                                     action="showSettings",
+                                     id=session_user.id)
+            else:
+                return "Password could not be changed"
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            return render('/usersettings/change_password_login.mako')
         return render('/usersettings/dialogs/notificate_setpassword.mako')
 
     @checkRole('cm_ka')



More information about the Mpuls-commits mailing list