#12524 closed (fixed)
Bad formatting on dates in JSON serializer causes ValidationError in loaddata
| Reported by: | Gabriel Farrell | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Serialization) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Using SQLite I saw the following error when doing a loaddata on a fixture I had just dumped out:
ValidationError: [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']
Some poking around revealed some dates in my database were set to "0001-01-01", but in the fixture they had been serialized as " 1-01-01". The attached patch to the datetime_safe util fixed the issue, allowing me to load the data back in, weird dates and all.
Attachments (2)
Change History (7)
by , 16 years ago
| Attachment: | safe_year.diff added |
|---|
comment:1 by , 16 years ago
| milestone: | → 1.2 |
|---|---|
| Needs tests: | set |
| Triage Stage: | Unreviewed → Accepted |
Could use a test case.
comment:2 by , 16 years ago
| Needs tests: | unset |
|---|
comment:3 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:4 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
Fill zeros on string-formatted years