I sent the wrong example. here is the right one

>>> import decimal
>>> db=DAL()
>>> db.define_table('a',Field('b','decimal(10,3)'))
>>> b=decimal.Decimal('123456789123.987654321')
>>> db.a.insert(b=b)
>>> for row in db(db.a.id>0).select():
>>>     print row.b, type(row.b)
123456789123.987 <class 'decimal.Decimal'>

This may work in forms but please check. There is also a new
validator

IS_DECIMAL_IN_RANGE(a,b)

where a and b can be themselves decimals

On Nov 13, 3:59 pm, mdipierro <[email protected]> wrote:
> In trunk, again you can now do (sqlite only)
>
> >>> import decimal
> >>> db=DAL()
> >>> db.define_table('a',Field('b','decimal(10,3)'))
> >>> b=123456789123.987654321
> >>> db.a.insert(b=b)
> >>> for row in db(db.a.id>0).select():
> >>>     print row.b, type(row.b)
>
> 123456789123.987 <class 'decimal.Decimal'>
>
> while this works it is not clear to how it should work with forms and
> validators. Right now you insert decimal, retrieve, search, orderby,
> add but you cannot put them in forms.
>
> On Nov 13, 2:53 pm, mdipierro <[email protected]> wrote:
>
> > I have a possible implementation of decimal in trunk for sqlite
>
> > Field('dollars','decimal(7,3)')
>
> > 3 decimals. Can you give it a try? Can we do better?
>
> > Massimo
>
> > On Nov 13, 7:39 am, Kuba Kucharski <[email protected]> wrote:
>
> > > +1
>
> > > --
> > > Kuba
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to