From 7e3cb52f7f5a661b2350a2e4377ca71880245886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 3 Oct 2011 23:31:58 +0200 Subject: [PATCH] Fix decimal._convert_other to work with Float on Python 2.7 review132001 --- trytond/protocols/datatype.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trytond/protocols/datatype.py b/trytond/protocols/datatype.py index 5c55a19e28..85d68481bd 100644 --- a/trytond/protocols/datatype.py +++ b/trytond/protocols/datatype.py @@ -1,7 +1,17 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. +import decimal from decimal import Decimal +_convert_other = decimal._convert_other + +def _convert_Float(other, *args, **kwargs): + if isinstance(other, Float): + return other.decimal + return _convert_other(other, *args, **kwargs) +decimal._convert_other = _convert_Float + + class Float(float): def __init__(self, value): super(Float, self).__init__()