diff --git a/addons/website_forum/models/ir_http.py b/addons/website_forum/models/ir_http.py index 2dc9a945aab..76974e01c4f 100644 --- a/addons/website_forum/models/ir_http.py +++ b/addons/website_forum/models/ir_http.py @@ -11,7 +11,8 @@ class ir_http(orm.AbstractModel): def _handle_exception(self, exception=None, code=500): #At this time it gives error when user's email address is not configured instead of raise exception so redirect user to update profile. #when website will handle exception then remove this code. - if exception and exception[1] and exception[1] == "Unable to send email, please configure the sender's email address or alias.": - forum = request.httprequest.path.strip('/forum').split('/') - return werkzeug.utils.redirect("/forum/%s/edit/profile/%s" % (forum[0],request.uid)) - return super(ir_http, self)._handle_exception(exception) + if code == 500 and isinstance(exception, openerp.osv.orm.except_orm): + if exception[1] == "Unable to send email, please configure the sender's email address or alias.": + forum = request.httprequest.path.strip('/forum').split('/') + return werkzeug.utils.redirect("/forum/%s/edit/profile/%s" % (forum[0],request.uid)) + return super(ir_http, self)._handle_exception(exception, code=code)