Django

Code

Changeset 4829

Show
Ignore:
Timestamp:
03/27/07 06:11:03 (2 years ago)
Author:
russellm
Message:

Improved error reporting when fixture files are provided in an unknown serialization format.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management.py

    r4780 r4829  
    13561356    app_fixtures = [os.path.join(os.path.dirname(app.__file__),'fixtures') for app in get_apps()] 
    13571357    for fixture_label in fixture_labels: 
     1358        parts = fixture_label.split('.') 
     1359        if len(parts) == 1: 
     1360            fixture_name = fixture_label 
     1361            formats = serializers.get_serializer_formats() 
     1362        else: 
     1363            fixture_name, format = '.'.join(parts[:-1]), parts[-1] 
     1364            if format in serializers.get_serializer_formats(): 
     1365                formats = [format] 
     1366            else: 
     1367                formats = [] 
     1368                 
    13581369        if verbosity > 0: 
    1359             print "Loading '%s' fixtures..." % fixture_label 
     1370            if formats: 
     1371                print "Loading '%s' fixtures..." % fixture_name 
     1372            else: 
     1373                print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format) 
     1374             
    13601375        for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']: 
    13611376            if verbosity > 1: 
    13621377                print "Checking %s for fixtures..." % humanize(fixture_dir) 
    1363             parts = fixture_label.split('.') 
    1364             if len(parts) == 1: 
    1365                 fixture_name = fixture_label 
    1366                 formats = serializers.get_serializer_formats() 
    1367             else: 
    1368                 fixture_name, format = '.'.join(parts[:-1]), parts[-1] 
    1369                 formats = [format] 
    13701378 
    13711379            label_found = False