4,2 have to do with precision, not range.

On Nov 17, 4:18 pm, Richard Vézina <[email protected]>
wrote:
> Ok,
>
> I think I wrongly define the IS_DECIMAL_IN_RANGE
>
> I set it to (0,99.99)
>
> And now the validators works.
>
> Still wondering if IS_DECIMAL_IN_RANGE as to be explicitly define since the
> decimal(4,2) were already available????
>
> Richard
>
> On Wed, Nov 17, 2010 at 4:06 PM, Richard Vézina <[email protected]
>
> > wrote:
> > Just to be sure... Data are entered in english... Mean if we entered
> > exactly this in the form fiel : 123.123
>
> > On Wed, Nov 17, 2010 at 3:59 PM, Jonathan Lundell <[email protected]>wrote:
>
> >> On Nov 17, 2010, at 12:26 PM, mdipierro wrote:
>
> >> > could be. Not sure what that means for decimal numbers.
>
> >> FWIW, I took a look at the Python decimal module, and it requires '.' as
> >> the decimal separator. So any conversion is going to have to happen before
> >> Decimal gets the string.
>
> >> > On Nov 17, 2:07 pm, Richard Vézina <[email protected]>
> >> > wrote:
> >> >> I use postgresql and local in postgres are : fr_CA.UTF-8
>
> >> >> Could it be the reason of the problem?
>
> >> >> Richard
>
> >> >> On Wed, Nov 17, 2010 at 2:37 PM, mdipierro <[email protected]>
> >> wrote:
> >> >>> BTW... why are you getting the traceback in french? If your python is
> >> >>> localized, could this affect the meaning of . in sqlite?
>
> >> >>> On Nov 17, 9:43 am, Richard Vézina <[email protected]>
> >> >>> wrote:
> >> >>>> Hello,
>
> >> >>>> I wonder if it is normal that I get ticket in that case :
>
> >> >>>> Model :
>
> >> >>>> Field('field1','decimal(4,2)'),
>
> >> >>>> If I insert in form generate with crud.create(db.table1) this value :
> >> >>>> 123.123
>
> >> >>>> I get ticket :
>
> >> >>>> Error traceback
>
> >> >>>> 1.
> >> >>>> 2.
> >> >>>> 3.
> >> >>>> 4.
> >> >>>> 5.
> >> >>>> 6.
> >> >>>> 7.
> >> >>>> 8.
> >> >>>> 9.
> >> >>>> 10.
> >> >>>> 11.
> >> >>>> 12.
> >> >>>> 13.
> >> >>>> 14.
> >> >>>> 15.
> >> >>>> 16.
> >> >>>> 17.
> >> >>>> 18.
> >> >>>> 19.
> >> >>>> 20.
> >> >>>> 21.
>
> >> >>>> Traceback (most recent call last):
> >> >>>>   File "/web2py/gluon/restricted.py", line 188, in restricted
> >> >>>>     exec ccode in environment
> >> >>>>   File "/web2py/applications/app/controllers/test.py", line 552, in
> >> >>> <module>
> >> >>>>   File "/web2py/gluon/globals.py", line 96, in <lambda>
> >> >>>>     self._caller = lambda f: f()
> >> >>>>   File "/web2py/gluon/tools.py", line 2270, in f
> >> >>>>     return action(*a, **b)
> >> >>>>   File "/web2py/applications/app/controllers/test.py", line 372, in
> >> >>> update
> >> >>>>     if form.accepts(request.vars, session):
> >> >>>>   File "/web2py/gluon/sqlhtml.py", line 1144, in accepts
> >> >>>>     self.table._db(self.table.id == self.record.id).update(**fields)
> >> >>>>   File "/web2py/gluon/sql.py", line 3484, in update
> >> >>>>     self._db._execute(query)
> >> >>>>   File "/web2py/gluon/sql.py", line 1026, in <lambda>
> >> >>>>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> >> >>>> DataError: ERREUR:  champ numérique en dehors des limites
> >> >>>> DETAIL:  Un champ de précision 4 et d'échelle 2 doit être arrondi à
> >> une
> >> >>> valeur
> >> >>>> absolue inférieure à 10^2.
>
> >> >>>> I thought that the validator will show up a error...
>
> >> >>>> Do I have to use IS_DECIMAL_IN_RANGE and why since I precised the
> >> decimal
> >> >>>> limit in the model???
>
> >> >>>> Regards.
>
> >> >>>> Richard
>
>

Reply via email to