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 ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
1
Beantwoorden
5029
Weergaven
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
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
1
mei 25
|
752 | ||
|
0
feb. 22
|
2817 | ||
|
2
jan. 22
|
2904 | ||
|
2
jan. 22
|
4018 | ||
|
0
sep. 21
|
200 |
I need to override def in http.py class JSONRequest method _handle_exception