[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
yes. better On Feb 8, 11:04 am, Jonathan Lundell wrote: > On Feb 8, 2010, at 8:34 AM, mdipierro wrote: > > > send me a patch! > > I'd suggest otherwise--in particular interpreting None as "no limit" in the > min or max direction. > > Interpreting (4) as (0,4) saves the developer two characters o

Re: [web2py] Re: validators, min and max

2010-02-08 Thread Jonathan Lundell
On Feb 8, 2010, at 8:34 AM, mdipierro wrote: > send me a patch! I'd suggest otherwise--in particular interpreting None as "no limit" in the min or max direction. Interpreting (4) as (0,4) saves the developer two characters of typing. But interpreting (4, None) or (None, 4) as no limit extends

[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
I am for it. On Feb 8, 10:41 am, Jonathan Lundell wrote: > On Feb 8, 2010, at 8:13 AM, DenesL wrote: > > > 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_F

Re: [web2py] Re: validators, min and max

2010-02-08 Thread Jonathan Lundell
On Feb 8, 2010, at 8:13 AM, DenesL wrote: > 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(). > Suggestion: interpret None as no limit. So your t

[web2py] Re: validators, min and max

2010-02-08 Thread pihentagy
On Feb 8, 5:13 pm, DenesL wrote: > On Feb 8, 4:15 am, "KONTRA, Gergely" wrote:> Hi! > > 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. Errr, so, INTs works as python ranges, and contrary, floats

[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
send me a patch! On Feb 8, 10:24 am, "KONTRA, Gergely" wrote: > >> 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(

[web2py] Re: validators, min and max

2010-02-08 Thread DenesL
LOL, you got me there... Can we make an exception? ... just kidding. On Feb 8, 11:24 am, "KONTRA, Gergely" wrote: > >> 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

Re: [web2py] Re: validators, min and max

2010-02-08 Thread KONTRA, Gergely
>> 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 inte

[web2py] Re: validators, min and max

2010-02-08 Thread DenesL
On Feb 8, 4: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. 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 t