On Feb 8, 4:15 am, "KONTRA, Gergely" <pihent...@gmail.com> wrote:
> Hi!
>
> I found another inconsistency in validators:
>
> IS_INT_IN_RANGE:
>
> IS_INT_IN_RANGE(0,10) does not accepts 10.
That is by design so that it works as the Python range built-in
function.
range(0,10) = [0,1,2,3,4,5,6,7,8,9]
>
> Yes, this is in the docs, but using using args minimum and maximum,
> how would one know, that it includes the start/end point?
> Similarly, IS_LENGTH, IS_DECIMAL_IN_RANGE and so on...?
>
> OTOH:
> IS_FLOAT_IN_RANGE(0,10) will accept 10, and will accept 0.
Since there is no equivalent in Python this one works as one would
normally expect.
> BTW equality comparision between floating points can be tricky, if the
> endpoints are not represented exactly.
> One, who worked with floating points may know this,but...
>
> So: being backward compatible, what about new possibilities:
> minInclusive, minExclusive, maxInclusive and maxExclusive, like in the
> xsd definition?
>
> And does it makes sense to make all min and max values optional, so
> you can have: enter an integer, which is larger than 2 (witout upper
> limit)?
Having had the need recently, I would like to see:
IS_INT_IN_RANGE(1) # any integer>0 (up to sys.maxint)
IS_INT_IN_RANGE(max=10) # any integer less than 10
and similarly for IS_FLOAT_IN_RANGE().
>
> +-[ Gergely Kontra <pihent...@gmail.com> ]------------------+
> |                                                           |
> | Mobile:(+36 20)356 9656                                   |
> |                                                           |
> +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to