On Thu, 2012-01-19 at 17:08 -0500, Rob Crittenden wrote:
> Martin Kosek wrote:
> > On Tue, 2012-01-17 at 11:27 +0100, Martin Kosek wrote:
> >> On Fri, 2012-01-13 at 21:02 +0100, Martin Kosek wrote:
> >>> This patch fixes RHEL 6.2 build issue.
> >>> ----
> >>> Having float type as a base type for floating point parameter in
> >>> ipalib introduces several issues, e.g. problem with representation
> >>> or value comparison. Python language provides Decimal type which
> >>> help overcome these issue.
> >>>
> >>> This patch replaces a float type with Decimal type in Float
> >>> parameter. A precision attribute was added to Float 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
> >>> number on server side.
> >>>
> >>> https://fedorahosted.org/freeipa/ticket/2260
> >>>
> >>
> >> Sending an improved version of the patch with following major changes:
> >>
> >> 1) Float parameter was renamed to Decimal as it base type is different
> >> and would confuse users otherwise.
> >>
> >> 2) Parameter maxvalue, minvalue and default can be also passed as a
> >> string and not just as a decimal.Decimal value. Parameter definition is
> >> then much simpler.
> >>
> >> 3) LDAP backend encoder was enhanced to support this new type (it
> >> converts it to string just like a float value).
> >>
> >> Martin
> >
> > I forgot to add an encoding rule to JSON xmlrpc server. This can be
> > useful in a future when Decimal type is actually used for a real LDAP
> > attribute.
> >
> > Martin
> 
> ACK. This is fine API-wise because the data is transmitted as a string, 
> so even if the client side defines the parameter as a Float it won't 
> affect what the server receives. The only possible downside is that the 
> precision requested on the client won't be honored on the server, but 
> then again the server decides what level of precision we want to support.
> 
> rob

Thanks for review. You are right, Decimal data type should handle a
param when its string or float. But we are even safer here as Decimal
parameters in new DNS API are the first parameters of this type in
FreeIPA. So old clients shouldn't even know any Decimal parameter.

Pushed to master, ipa-2-2.

Martin

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to