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:
> 99999999999999,<type 'str'>,<type 'float'>,<type 'int'>
> 
> Why it makes int from 99999999999999?

Probably because you're running 64-bit Python.

> 
> On 10 мар, 16:50, villas <villa...@gmail.com> wrote:
>> 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 Mar 10, 8:27 am, LightOfMooN <vladsale...@yandex.ru> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> 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:
>>>         pass
>> 
>>> it rises error
>>> <class 'psycopg2.InternalError'>(current transaction is aborted,
>>> commands ignored until end of transaction block)
>>> only if value not in range (-2147483648 : 2147483647)
>> 
>>> so I type in shell
>>> a = 2147483647
>>> type(a)>>> <type 'int'>
>> 
>>> a +=9999
>>> a
>> 
>>>>>> 2147493646
>>> type(a)
>>>>>> <type 'int'>
>> 
>>> but I think it's already must be long
>> 
>>> On 10 ÍÁÒ, 03:35, Massimo Di Pierro <massimo.dipie...@gmail.com>
>>> wrote:
>> 
>>>> Can I see more of the code without ...
>> 
>>>> On Mar 9, 3:17špm, LightOfMooN <vladsale...@yandex.ru> wrote:
>> 
>>>>> value=request.vars.myvar
>> 
>>>>> try:
>>>>> š š value = int(value)
>>>>> except:
>>>>> š š pass
>> 
>>>>> if type(value)==int:
>>>>> š š insert(....)
>> 
>>>>> it rises
>>>>> <class 'psycopg2.InternalError'>(current transaction is aborted,
>>>>> commands ignored until end of transaction block)
>>>>> even if value > 2147483647
>> 
>>>>> But why?
>>>>> It's so strange, because type(value) must be long.


Reply via email to