Ticket #9011: loaddata_file_format_invalid.patch

File loaddata_file_format_invalid.patch, 1.9 KB (added by jlrivitti@…, 16 years ago)
  • django/core/management/commands/loaddata.py

     
    136136                                             (full_path, traceback.format_exc())))
    137137                                return
    138138                            fixture.close()
     139
     140                            # If any of the fixtures we loaded contain 0 objects, assume that an
     141                            # error was encountered during fixture loading.
     142                            if 0 in objects_per_fixture:
     143                                sys.stderr.write(
     144                                    self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)" %
     145                                        (fixture_name)))
     146                                transaction.rollback()
     147                                transaction.leave_transaction_management()
     148                                return
    139149                    except:
    140150                        if verbosity > 1:
    141151                            print "No %s fixture '%s' in %s." % \
    142152                                (format, fixture_name, humanize(fixture_dir))
    143153
    144154
    145         # If any of the fixtures we loaded contain 0 objects, assume that an
    146         # error was encountered during fixture loading.
    147         if 0 in objects_per_fixture:
    148             sys.stderr.write(
    149                 self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)" %
    150                     (fixture_name)))
    151             transaction.rollback()
    152             transaction.leave_transaction_management()
    153             return
    154            
    155155        # If we found even one object in a fixture, we need to reset the
    156156        # database sequences.
    157157        if object_count > 0:
Back to Top