콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5476 화면

I'm trying to hide the debug code from seesion expired error, so i need to override the _handle_exception method to delete debug code from exception. Can anyone explain how to do this ?

아바타
취소
작성자

I need to override def in http.py class JSONRequest method _handle_exception

베스트 답변

Hi Kitty,

You can do it like this.

Inside the controller,

from odoo.addons.base.ir import ir_http

class IrHttp(ir_http.IrHttp):

@classmethod
def _handle_exception(cls, exception):
# If handle_exception returns something different than None, it will be used as a response

# This is done first as the attachment path may
# not match any HTTP controller
if isinstance(exception, werkzeug.exceptions.HTTPException) and exception.code == 404:
attach = cls._serve_attachment()
if attach:
return attach

# Don't handle exception but use werkeug debugger if server in --dev mode
if 'werkzeug' in tools.config['dev_mode']:
raise
try:
return request._handle_exception(exception)
except AccessDenied:
return werkzeug.exceptions.Forbidden()

Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
5월 25
1276
0
2월 22
3251
2
1월 22
3440
2
1월 22
4556
0
9월 21
200