Re: Possible bug with Number validator

Aston Motes <[email protected]> Tue, 7 Apr 2009 22:09:17 -0400
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
I don't (really) mind infinity being accepted; it's just weird that
the validator ends up raising an exception no part of the stack is
expecting. It pretty much makes using the validate decorator
impossible without wrapping it up with my own thing.

Or maybe you're saying infinity works correctly (no exception raised)
in the new version of formencode? I'm still on 0.7.1.

   - Aston

On Tue, Apr 7, 2009 at 9:55 PM, Ian Bicking <[email protected]> wrote:
> Yes, probably it would be reasonable behavior for 'inf' to be invalid,
> except if some settings was on the Number validator to allow it (like
> Number(allow_infinity=True)).  But at the moment infinity is allowed and
> actually tested for.  I guess at some point I was convinced it would be a
> good idea to just accept it.
>
> On Tue, Apr 7, 2009 at 7:56 PM, Aston Motes <[email protected]> wrote:
>>
>> I generally expect the Number validator to either return a number
>> (float or int) or raise an Invalid exception. However, if I do the
>> following:
>>
>> from formencode.validators import Number
>> Number.to_python('inf')
>>
>> I get an OverflowError related to 'inf' being interpreted as the float
>> infinity. The same thing happens with 'infinity' as the input string.
>>
>> Is this a for reals bug with FormEncode, or just a corner case
>> exception I should be aware of and catch?
>>
>> Thanks,
>>   - Aston
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> High Quality Requirements in a Collaborative Environment.
>> Download a free trial of Rational Requirements Composer Now!
>> http://p.sf.net/sfu/www-ibm-com
>> _______________________________________________
>> FormEncode-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/formencode-discuss
>
>
>
> --
> Ian Bicking  |  http://blog.ianbicking.org
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
FormEncode-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-discuss