#21457 closed Bug (fixed)
Possible loaddata filename regression
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.6 |
Severity: | Normal | 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
Just did a pip install --upgrade Django
from 1.5.5 to 1.6 to test what changes I'd need to make. Previously, the following worked fine:
python manage.py loaddata initial_data.auth.json
which was a handy way of declaring that some data might be needed on first-usage, without actually having it clobber whatever data is in the DB every time thereafter, as initial_data is wont to do.
As of 1.6, this now results in an error:
CommandError: Problem installing fixture 'initial_data': auth is not a known serialization format.
I can't see mention in the release notes, or the loaddata/dumpdata/fixtures docs suggesting anything has changed in such a way that this is expected behaviour.
Attachments (1)
Change History (8)
comment:1 by , 11 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Cc: | added |
---|
Digging a bit deeper, I also found that a TypeError
is raised if the filename contains several periods (foo.bar.baz.json
for example).
I've added two tests (see attached patch) for these issues and from what I can tell, they fail because of the following lines: https://github.com/django/django/blob/7ad3ab081cf540808a503f9dd18e7720a239bf22/django/core/management/commands/loaddata.py#L178-L182
Unfortunately, removing this causes another test to fail (fixtures_regress.tests.TestFixtures.test_unkown_format
).
by , 11 years ago
Attachment: | ticket_21457_tests.diff added |
---|
comment:4 by , 11 years ago
Cc: | removed |
---|---|
Severity: | Release blocker → Normal |
Triage Stage: | Accepted → Unreviewed |
(Posting now a comment I wrote this morning, but disconnected before I could submit it.)
You were apparently relying on undocumented behavior. The pattern supported by Django for fixtures file names is: <filename>.<database>.<format>.<compression> where you need to provide at least <filename> as a command line argument. You should use loaddata initial_data.auth
.
loaddata
was refactored in 51aa000378c00a442273f01142acdebc94dec68d
to locate files more efficiently (10 to 1000 times faster depending on your project). That probably explains the difference you're seeing.
comment:5 by , 11 years ago
Erm, I shouldn't analyze tickets after waking up at 5:30 to catch a train. In fact it's a plain bug.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi,
I can reproduce the issue when the filename contains a period (it works fine otherwise).
I tracked down the regression to commit 51aa000378c00a442273f01142acdebc94dec68d.
Thanks for the report.