[IMP] improved code

bzr revid: tpa@tinyerp.com-20140402104743-qn0vj5o147l0c81d
This commit is contained in:
Turkesh Patel (Open ERP) 2014-04-02 16:17:43 +05:30
parent 46b164ea2e
commit 07a0f872a4
1 changed files with 5 additions and 4 deletions

View File

@ -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)