summaryrefslogtreecommitdiffstats
path: root/ipalib/__init__.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-01-17 11:19:00 +0100
committerMartin Kosek <mkosek@redhat.com>2012-01-20 08:14:02 +0100
commit8c230f1d7b3309c6590f28a65966515fb918e245 (patch)
tree9eac7295f1c6a67e2786721327f7cac633012630 /ipalib/__init__.py
parentea678b5045b2ee7c6730fe7ad22e7fa3f7f0afd9 (diff)
downloadfreeipa.git-8c230f1d7b3309c6590f28a65966515fb918e245.tar.gz
freeipa.git-8c230f1d7b3309c6590f28a65966515fb918e245.tar.xz
freeipa.git-8c230f1d7b3309c6590f28a65966515fb918e245.zip
Replace float with Decimal
Having float type as a base type for floating point parameters in ipalib introduces several issues, e.g. problem with representation or value comparison. Python language provides a Decimal type which help overcome these issues. This patch replaces a float type and Float parameter with a decimal.Decimal type in Decimal parameter. A precision attribute was added to Decimal parameter that can be used to limit a number of decimal places in parameter representation. This approach fixes a problem with API.txt validation where comparison of float values may fail on different architectures due to float representation error. In order to safely transfer the parameter value over RPC it is being converted to string which is then converted back to decimal.Decimal number on a server side. https://fedorahosted.org/freeipa/ticket/2260
Diffstat (limited to 'ipalib/__init__.py')
-rw-r--r--ipalib/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py
index 29ba0bb9..1efeeab4 100644
--- a/ipalib/__init__.py
+++ b/ipalib/__init__.py
@@ -878,7 +878,7 @@ from backend import Backend
from frontend import Command, LocalOrRemote, Updater
from frontend import Object, Method, Property
from crud import Create, Retrieve, Update, Delete, Search
-from parameters import DefaultFrom, Bool, Flag, Int, Float, Bytes, Str, IA5Str, Password
+from parameters import DefaultFrom, Bool, Flag, Int, Decimal, Bytes, Str, IA5Str, Password
from parameters import BytesEnum, StrEnum, AccessTime, File
from errors import SkipPluginModule
from text import _, ngettext, GettextFactory, NGettextFactory