From 240943961e053f4ac51be638f9641c0a798274f4 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 5 Jun 2012 17:26:30 +0200 Subject: [PATCH] [IMP] log exceptions in safe_eval bzr revid: chs@openerp.com-20120605152630-d4flr4c3mwl7wnvx --- openerp/tools/safe_eval.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openerp/tools/safe_eval.py b/openerp/tools/safe_eval.py index a542fa44a42..601fd95200a 100644 --- a/openerp/tools/safe_eval.py +++ b/openerp/tools/safe_eval.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# Copyright (C) 2004-2010 OpenERP s.a. (). +# Copyright (C) 2004-2012 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -238,6 +238,10 @@ def safe_eval(expr, globals_dict=None, locals_dict=None, mode="eval", nocopy=Fal 'set' : set } ) - return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict) + try: + return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict) + except Exception: + _logger.exception('Cannot eval %r', expr) + raise # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: