Ticket #9011: loaddata_file_format_invalid.patch
File loaddata_file_format_invalid.patch, 1.9 KB (added by , 16 years ago) |
---|
-
django/core/management/commands/loaddata.py
136 136 (full_path, traceback.format_exc()))) 137 137 return 138 138 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 139 149 except: 140 150 if verbosity > 1: 141 151 print "No %s fixture '%s' in %s." % \ 142 152 (format, fixture_name, humanize(fixture_dir)) 143 153 144 154 145 # If any of the fixtures we loaded contain 0 objects, assume that an146 # 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 return154 155 155 # If we found even one object in a fixture, we need to reset the 156 156 # database sequences. 157 157 if object_count > 0: