Django

Code

Ticket #6436 (closed: fixed)

Opened 6 months ago

Last modified 5 months ago

loaddata can load fixture data multiple times, if specified with absolute pathname

Reported by: btoll <btoll@bestweb.net> Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords: loaddata absolute pathname
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Attached patch includes a regression test that demonstrates issue, along with a proposed fix (for review).

The situation can arise if a project has a test fixture that is maintained outside of the project structure. An attempt to load the fixture with an absolute path, e.g.

python manage.py loaddata /path/to/fixture

will work, but consumes more time and memory than necessary, since the fixture data will be loaded once for every fixture directory in a project (in either an installed application or FIXTURE_DIRS).

This effect can be observed in the count of objects and fixtures that are reported by the loaddata command. Setting '--verbosity=2' makes it more apparent.

Attachments

loaddata_absolute_20080121a.diff (2.6 kB) - added by btoll <btoll@bestweb.net> on 01/21/08 13:50:56.
Regression test and proposed fix

Change History

01/21/08 13:50:56 changed by btoll <btoll@bestweb.net>

  • attachment loaddata_absolute_20080121a.diff added.

Regression test and proposed fix

02/22/08 06:14:18 changed by btoll

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

02/22/08 06:50:11 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [7145]) Fixed #6436 -- Added check for absolute paths in fixture loading. Fixtures specified as an absolute path were being loaded multiple times. Thanks to btoll@bestweb.net for the report, fix, and catch of a duplicate ticket.


Add/Change #6436 (loaddata can load fixture data multiple times, if specified with absolute pathname)




Change Properties
Action