Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16151 closed Cleanup/optimization (worksforme)

More informative message than "No fixtures found"

Reported by: Luc Saffre Owned by: nobody
Component: Core (Serialization) Version: 1.3
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


When I run loaddata with a long list of fixture labels, and if for some of these there are no fixtures, then Django issues several times the message "No fixtures found." It would be more informative to mention the fixture name in that message. I suggest to change one line in django/core/management/commands/

 if fixture_object_count == 0:
     if verbosity >= 1:
         self.stdout.write("No fixtures found.\n")

Change this to:

 if fixture_object_count == 0:
     if verbosity >= 1:
         self.stdout.write("No %r fixtures found.\n" % fixture_name)

Change History (2)

comment:1 Changed 9 years ago by Aymeric Augustin

Resolution: worksforme
Status: newclosed

I am unable to reproduce. That message is printed only once, if no objects are created from any fixture. Here's what I get:

% ./ dumpdata > foo.json
% ./ loaddata foo bar
Installed 19 object(s) from 1 fixture(s)
% ./ loaddata bar baz
No fixtures found.

The piece of code you're mentionning is outside of the main loop: for fixture_label in fixture_labels: ...; fixture_name is leaked in scope from the last run of the loop. It's wrong to use it.

comment:2 Changed 9 years ago by Luc Saffre

Oops, you're right, my shot was too quick.

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