On Mar 10, 2011, at 11:57 AM, LightOfMooN wrote: > > the same result.. > > so my validate for value is: > isinstance(value, int) and -2147483649<value<2147483648 > > 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 <mulone.mar...@gmail.com> wrote: >> Better use: >> >> if isinstance(value, int): >> >> instead of >> >> if type(value)==int: >> >> 2011/3/9 LightOfMooN <vladsale...@yandex.ru> >> >> >> >> >> >> >> >> >> >>> 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. >> >> -- >> Pablo Martín Mulone (mar...@tecnodoc.com.ar)http://www.tecnodoc.com.ar/ >> >> My blog:http://martin.tecnodoc.com.ar >> Expert4Solution Profile:http://www.experts4solutions.com/e4s/default/expert/6