1# -*- coding: utf-8 -*- 2# Part of Odoo. See LICENSE file for full copyright and licensing details. 3import importlib 4import logging 5import types 6 7_logger = logging.getLogger(__name__) 8SUPPORTED_DEBUGGER = {'pdb', 'ipdb', 'wdb', 'pudb'} 9 10 11def post_mortem(config, info): 12 if config['dev_mode'] and isinstance(info[2], types.TracebackType): 13 debug = next((opt for opt in config['dev_mode'] if opt in SUPPORTED_DEBUGGER), None) 14 if debug: 15 try: 16 # Try to import the xpdb from config (pdb, ipdb, pudb, ...) 17 importlib.import_module(debug).post_mortem(info[2]) 18 except ImportError: 19 _logger.error('Error while importing %s.' % debug) 20