From 74e08bee07cefc28ef9884f4080b2b256a664ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Sep 2009 11:23:25 +0200 Subject: [PATCH] Use safe_eval --- price_list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/price_list.py b/price_list.py index 09ea7fddeb..f277277a9a 100644 --- a/price_list.py +++ b/price_list.py @@ -1,6 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. from trytond.model import ModelView, ModelSQL, fields +from trytond.tools import safe_eval from decimal import Decimal import re @@ -214,7 +215,7 @@ class PriceListLine(ModelSQL, ModelView): context = {} ctx = context.copy() ctx['Decimal'] = Decimal - return eval(_RE_DECIMAL.sub(lambda m: "Decimal('%s')" % m.group(1), + return safe_eval(_RE_DECIMAL.sub(lambda m: "Decimal('%s')" % m.group(1), line.formula), ctx) PriceListLine()