Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved error reporting when fixture files are provided in an unknow…

…n serialization format.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 750ea554c12b34f7b68653488f345f4066191e08 1 parent 8a0b3ed
@freakboy3742 freakboy3742 authored
Showing with 16 additions and 8 deletions.
  1. +16 −8 django/core/management.py
View
24 django/core/management.py
@@ -1355,18 +1355,26 @@ def load_data(fixture_labels, verbosity=1):
app_fixtures = [os.path.join(os.path.dirname(app.__file__),'fixtures') for app in get_apps()]
for fixture_label in fixture_labels:
+ parts = fixture_label.split('.')
+ if len(parts) == 1:
+ fixture_name = fixture_label
+ formats = serializers.get_serializer_formats()
+ else:
+ fixture_name, format = '.'.join(parts[:-1]), parts[-1]
+ if format in serializers.get_serializer_formats():
+ formats = [format]
+ else:
+ formats = []
+
if verbosity > 0:
- print "Loading '%s' fixtures..." % fixture_label
+ if formats:
+ print "Loading '%s' fixtures..." % fixture_name
+ else:
+ print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format)
+
for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']:
if verbosity > 1:
print "Checking %s for fixtures..." % humanize(fixture_dir)
- parts = fixture_label.split('.')
- if len(parts) == 1:
- fixture_name = fixture_label
- formats = serializers.get_serializer_formats()
- else:
- fixture_name, format = '.'.join(parts[:-1]), parts[-1]
- formats = [format]
label_found = False
for format in formats:
Please sign in to comment.
Something went wrong with that request. Please try again.