Ticket #18990: 18990.patch

File 18990.patch, 1.5 KB (added by Türker Sezer, 12 years ago)

show warning if there isn't any file for a label.

  • django/core/management/commands/loaddata.py

     
    104104        try:
    105105            with connection.constraint_checks_disabled():
    106106                for fixture_label in fixture_labels:
     107                    fixture_file_found = 0
    107108                    parts = fixture_label.split('.')
    108109
    109110                    if len(parts) > 1 and parts[-1] in compression_types:
     
    160161                            open_method = compression_types[compression_format]
    161162                            try:
    162163                                fixture = open_method(full_path, 'r')
     164                                fixture_file_found = 1
    163165                            except IOError:
    164166                                if verbosity >= 2:
    165167                                    self.stdout.write("No %s fixture '%s' in %s.\n" % \
     
    216218                                        transaction.leave_transaction_management(using=using)
    217219                                    return
    218220
     221                    if not fixture_file_found:
     222                        self.stderr.write("Any fixture file couldn't be found for '%s'" %
     223                            fixture_label)
     224
    219225            # Since we disabled constraint checks, we must manually check for
    220226            # any invalid keys that might have been added
    221227            table_names = [model._meta.db_table for model in models]
Back to Top