Re: [web2py] Re: problem with type Int

2011-03-10 Thread Jonathan Lundell
On Mar 10, 2011, at 2:18 PM, LightOfMooN wrote: > > because it's not beautiful ;) Well, the field you're using in the database doesn't have a beautiful constraint... > > On 11 мар, 03:16, Jonathan Lundell wrote: >> On Mar 10, 2011, at 11:57 AM, LightOfMooN wrote: >> >> >> >>> the same resu

[web2py] Re: problem with type Int

2011-03-10 Thread LightOfMooN
because it's not beautiful ;) On 11 мар, 03:16, Jonathan Lundell wrote: > On Mar 10, 2011, at 11:57 AM, LightOfMooN wrote: > > > > > the same result.. > > > so my validate for value is: > > isinstance(value, int) and -2147483649 > > It works fine, but... it's not good... > > Why not? You shouldn'

Re: [web2py] Re: problem with type Int

2011-03-10 Thread Jonathan Lundell
On Mar 10, 2011, at 11:57 AM, LightOfMooN wrote: > > the same result.. > > so my validate for value is: > isinstance(value, int) and -2147483649 > It works fine, but... it's not good... Why not? You shouldn't be relying on sizeof(int). > > On 10 мар, 23:32, Martín Mulone wrote: >> Better use

[web2py] Re: problem with type Int

2011-03-10 Thread LightOfMooN
the same result.. so my validate for value is: isinstance(value, int) and -2147483649 wrote: > Better use: > > if isinstance(value, int): > > instead of > > if type(value)==int: > > 2011/3/9 LightOfMooN > > > > > > > > > > > value=request.vars.myvar > > > try: > >    value = int(value) > > except

Re: [web2py] Re: problem with type Int

2011-03-10 Thread Jonathan Lundell
On Mar 10, 2011, at 9:36 AM, LightOfMooN wrote: > > Full function is too complex. > But this little shows the problem well: > > value=request.vars.myvar > t = type(value) > value = float(value) > t2 = type(value) > value = int(value) > t3 = type(value) > print value, t, t2, t3 > > result: >

[web2py] Re: problem with type Int

2011-03-10 Thread LightOfMooN
Full function is too complex. But this little shows the problem well: value=request.vars.myvar t = type(value) value = float(value) t2 = type(value) value = int(value) t3 = type(value) print value, t, t2, t3 result: 99,,, Why it makes int from 99? On 10 мар, 16:50, villa

[web2py] Re: problem with type Int

2011-03-10 Thread villas
Why don't you try testing the value of 'value' in your code by using a print statement to the console? At least that's what I usually do. You would ideally provide the entire controller function because your code does not explain itself very well to me (although it may be obvious to others!). On

[web2py] Re: problem with type Int

2011-03-10 Thread LightOfMooN
Yes, ofc controller/function: prop = db(db.properties.id==request.args(0)).select().first() value=request.vars.myvar try: value = int(value) except: pass if value!=prop.value and type(value)==int: try: db(db.properties.id==request.args(0)).update(value=value) except:

[web2py] Re: problem with type Int

2011-03-09 Thread Massimo Di Pierro
Can I see more of the code without ... On Mar 9, 3:17 pm, LightOfMooN wrote: > value=request.vars.myvar > > try: >     value = int(value) > except: >     pass > > if type(value)==int: >     insert() > > it rises > (current transaction is aborted, > commands ignored until end of transaction bl