Dont rollback transaction on errors in management/loaddata in "non-commit" mode.
|Reported by:||Vadim Fint||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
loaddata command by default tries to use transaction for all it's work. But it accepts commit=False, which can made whole loaddata call part of outer transaction (this is usefull for call_command :)). But.. on any error - loaddata will close transaction in any way :(.
- Start transaction
- Create something in db
- Call loaddata with commit=False (in try..except block -- we can have possible error and we know that)
- Got an error while loaddata
- Ooops.. loaddata rollbacks whole transaction, thus my changes in 1st step are gone
But.. loaddata for easy using in non-interactive mode should also return something "okay" to callee, right now there is no way to determine that. But this is not covered by this ticket :).
p.s. not sure about component -- "Core framework" or "django-admin.py"?
Change History (13)
comment:1 Changed 8 years ago by
|Patch needs improvement:||unset|