Fixed #6497 -- Improved fixture error reporting by displaying the entire traceback. Also, SystemExit and KeyboardInterrupt now exit the script properly. Thanks for the patch, Bastian Kleineidam

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7653 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2008-06-16 04:00:08 +00:00
parent a0a06d1a89
commit ee882b6abd
1 changed files with 5 additions and 2 deletions

View File

@ -111,7 +111,10 @@ class Command(BaseCommand):
models.add(obj.object.__class__) models.add(obj.object.__class__)
obj.save() obj.save()
label_found = True label_found = True
except Exception, e: except (SystemExit, KeyboardInterrupt):
raise
except Exception:
import traceback
fixture.close() fixture.close()
transaction.rollback() transaction.rollback()
transaction.leave_transaction_management() transaction.leave_transaction_management()
@ -121,7 +124,7 @@ class Command(BaseCommand):
else: else:
sys.stderr.write( sys.stderr.write(
self.style.ERROR("Problem installing fixture '%s': %s\n" % self.style.ERROR("Problem installing fixture '%s': %s\n" %
(full_path, str(e)))) (full_path, traceback.format_exc())))
return return
fixture.close() fixture.close()
except: except: