Mission control is convinced there is no real reason not to use double since, even if the database may store them as decimals there is no decimal type in python, hence this extra conversion can only hurt you.
You can very much mimic decimals using validators: class IS_DECIMAL: def __init__ (self,decimals=2,minimum=-10**9,maximum=10**9,error_message='bla bla bla'): self.decimals=decimals self.minimum=minimum self.maximum=maximum self.error_message=error_message def __call__(self,value): (v,e)=IS_FLOAT_IN_RANGE (self.minimum,self.maximum,self.error_message)(value) if e: return (v,e) return int(v*(10**self.decimals)) def formatter(self,value): return float(value)/(10**self.decimals) SQLField('myfield','integer',requires=IS_DECIMAL()) In this way you store is as a long integer and always process it as an integer but you display is with a decimal point. On May 23, 7:08 pm, dlypka <dly...@gmail.com> wrote: > A workaround (until web2py mission control can be convinced to support > decimal type) would be to store them as string (similar to BCD > concept) > and then convert to python decimal when needed. Luckily python itself > supports decimal. > > On May 23, 7:56 pm, Pystar <aitoehi...@gmail.com> wrote: > > > Cant you use "float" when specifying the field type in the database > > definition? > > > On May 23, 9:43 pm, "Francois (Jersey)" > > > <francois.ches...@googlemail.com> wrote: > > > Dear all, > > > > Having a numeric/decimal support for web2py is key to produce > > > applications including accounting or financial aspects, and there had > > > been discussions about it back in March. > > > > I understand that the reason for not including decimal or numerical is > > > that it is not supported by all the database. > > > > Mysql, postgre and sqlite all support this numeric/decimal feature. > > > > I would be keen to contribute an accounting software to web2py, but I > > > need DECIMAL or NUMERIC support. > > > > Any comments for or against. > > > > Francois > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---