[Freeipa-devel] Integer parameters
Pavel Zuna
pzuna at redhat.com
Mon Oct 19 13:12:57 UTC 2009
John Dennis wrote:
> I wanted to assure myself if a command was expecting an integer value,
> it could be input in whatever radix the user desires and be correctly
> converted. If I understand correctly this code is in parameters.py and
> is implemented by the _convert_scalar member function. The Int and Float
> classes derive from the Number class and inherit Number._convert_scalar
> which attempts to call the type (e.g. constructor). However the int
> class only supports base 10 radix strings in it's constructor, it will
> not do radix conversion. Shouldn't the Int parameter class have it's own
> _convert_scalar which invokes int(value, 0)? (Note: the second argument
> to the int constructor is the radix base, with 0 being a special value
> indicating the radix is to be derived from the prefix)
>
Int only accepts base 10. As you say, we could extend _convert_scalar and have
it accept different bases. The question is, do we need/want it to? If we do,
then it shouldn't be too hard to implement (and I volunteer to do it).
Pavel
More information about the Freeipa-devel
mailing list