On Feb 8, 2010, at 1:15 AM, KONTRA, Gergely wrote:

> Hi!
> 
> I found another inconsistency in validators:
> 
> IS_INT_IN_RANGE:
> 
> IS_INT_IN_RANGE(0,10) does not accepts 10.

Notice that the default error message for this test is, "enter a number between 
0 and 9", so the user gets a relatively clear message. The programmer's view, 
OTOH, is consistent with the Python range convention.

> 
> 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.
> 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)?

Consider that the purpose of the validator functions is to process user input, 
not general computation. It's always possible to write a custom validator if 
the stock ones don't suffice.

> 
> 
> +-[ 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.
> 


-- 
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