Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21457 closed Bug (fixed)

Possible loaddata filename regression

Reported by: Keryn Knight <django@…> 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


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 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)

ticket_21457_tests.diff (2.0 KB) - added by bmispelon 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by bmispelon

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted


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.

comment:2 Changed 3 years ago by bmispelon

  • Cc bmispelon added

Digging a bit deeper, I also found that a TypeError is raised if the filename contains several periods ( 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:

Unfortunately, removing this causes another test to fail (fixtures_regress.tests.TestFixtures.test_unkown_format).

Changed 3 years ago by bmispelon

comment:4 Changed 3 years ago by aaugustin

  • Cc bmispelon removed
  • Severity changed from Release blocker to Normal
  • Triage Stage changed from Accepted to 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 Changed 3 years ago by aaugustin

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 Changed 3 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 97ac22ebfca0a5b0759f495cc5d7bed3f9da6615:

Fixed #21457 -- Allowed fixture file name to contain dots

Thanks Keryn Knight for the report.

comment:7 Changed 3 years ago by Claude Paroz <claude@…>

In 833f7d11e8f1d0171bac23e2e78c1111a83fbeaa:

[1.6.x] Fixed #21457 -- Allowed fixture file name to contain dots

Thanks Keryn Knight for the report.
Backport of 97ac22ebfc from master.

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