Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#230 closed defect (fixed)

FloatField with MySQL Backend fails silently

Reported by: alastair@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: 1.0
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adrian Holovaty)

If I have a FloatField with a particular precision, and I submit a form that has higher precision than I specified when creating the model, it will fail silently. When I say fail silently, and error is raised but no description is passed out of the validator. An example model :

  meta.FloatField('latitude', max_digits=10, decimal_places=7, default=0.0),                                                       
  meta.FloatField('longitude',  max_digits=10, decimal_places=7,  default=0.0),

And then if I have an input that is either more than 10 digits or 7 decimal places, it will fail.

I'm not sure where I could insert any rounding off near the validation model. I was thinking of doing it similar to a typecast as in date/time strings.

Change History (4)

comment:1 Changed 13 years ago by Jacob

milestone: Version 1.0

comment:2 Changed 13 years ago by Adrian Holovaty

Description: modified (diff)

(Fixed formatting in description.)

comment:3 Changed 12 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

This has been fixed at some indeterminate point in the past, I believe. We raise a validation error (with an error string) when either the whole part or the decimal part or the entire float fail to meet validation requirements. "Rounding off" as specified near the end of the report is the caller's responsibility.

comment:4 Changed 12 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top