Hello,I was under the impression that IS_DECIMAL_IN_RANGE(2.25, 5.25) would validate and prevent input having more places the number of places of min and max...
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Realize that, though I am sure it use to managed it...
Anyway, I find it curious that even if I have field of type decimal(10, 2) for instance, if I insert 1.304, and submit the form it ends up with 1.304 in the read form (backend has 3 places).
How do we validated the number of places??
It appears that it get silently "cropped/rounded" by the backend field type configuration... If I have field with 2 places in the backend and 3 places defined in the models and input 0.647, it will be stored as 0.65.Do we have control over the rounding in web2py or it configure in the database engine??
--
--
There seems to have some thing related to gae : https://github.com/web2py/pydal/blob/a7b7e4c11604d0b8b2de46e832469b78bfd7a1cf/pydal/helpers/gae.py#L16
It maybe just me, but I kind of think that if my models says decimal(10, 2) it means that I don't want to store more than 2 places... Since my models should behave like the database table and column as they are just an abstraction of the later...
--
I hear you and I agree about that... I am just supprise that we have no control over rouding of what goes in the database as it is very critical in some use case with weird rounding spec that you could have in academic sometime for instance.