=== modified file 'django/core/management/commands/loaddata.py'
|
|
|
103 | 103 | sys.stderr.write( |
104 | 104 | self.style.ERROR("Problem installing fixture '%s': %s is not a known serialization format." % |
105 | 105 | (fixture_name, format))) |
106 | | transaction.rollback() |
107 | | transaction.leave_transaction_management() |
| 106 | if commit: |
| 107 | transaction.rollback() |
| 108 | transaction.leave_transaction_management() |
108 | 109 | return |
109 | 110 | |
110 | 111 | if os.path.isabs(fixture_name): |
… |
… |
|
136 | 137 | fixture.close() |
137 | 138 | print self.style.ERROR("Multiple fixtures named '%s' in %s. Aborting." % |
138 | 139 | (fixture_name, humanize(fixture_dir))) |
139 | | transaction.rollback() |
140 | | transaction.leave_transaction_management() |
| 140 | if commit: |
| 141 | transaction.rollback() |
| 142 | transaction.leave_transaction_management() |
141 | 143 | return |
142 | 144 | else: |
143 | 145 | fixture_count += 1 |
… |
… |
|
158 | 160 | except Exception: |
159 | 161 | import traceback |
160 | 162 | fixture.close() |
161 | | transaction.rollback() |
162 | | transaction.leave_transaction_management() |
| 163 | if commit: |
| 164 | transaction.rollback() |
| 165 | transaction.leave_transaction_management() |
163 | 166 | if show_traceback: |
164 | 167 | traceback.print_exc() |
165 | 168 | else: |
… |
… |
|
176 | 179 | sys.stderr.write( |
177 | 180 | self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)" % |
178 | 181 | (fixture_name))) |
179 | | transaction.rollback() |
180 | | transaction.leave_transaction_management() |
| 182 | if commit: |
| 183 | transaction.rollback() |
| 184 | transaction.leave_transaction_management() |
181 | 185 | return |
182 | 186 | |
183 | 187 | except Exception, e: |