Opened 13 years ago
Closed 12 years ago
#16491 closed Uncategorized (fixed)
transaction.is_dirty() is very (and surprisingly) conservative
Reported by: | Michael Hudson-Doyle | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
As near as I can tell transaction.is_dirty() returns True if any queries have been executed at all (I think this is what lead to #15317 being reported). This is sort of fair enough (it's better to have a false positive for this sort of thing) but it certainly confused me for a good few minutes (commit_manually was complaining at me on exit). If it can't be made more accurate, at least the docstring should be improved. I'll try to come up with a patch tomorrow.
Change History (3)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
I find no occurrences of the string "Django will raise a TransactionManagementError exception" in the Django code base. Is the commit_manually docstring still misleading?
def commit_manually(using=None): """ Decorator that activates manual transaction control. It just disables automatic transaction control and doesn't do any commit/rollback of its own -- it's up to the user to call the commit and rollback functions themselves. """ ...
I suggest this bug is marked as resolved.
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is the fix that is already committed:
https://github.com/django/django/commit/620e0bba4969f27230d35f75bc6a1624c3fac747
We're discussing https://docs.djangoproject.com/en/dev/topics/db/transactions/. I'm accepting this ticket as a documentation patch, to fix the following inconsistency.
The docs for
commit_manually()
say:This is incompatible with the next paragraph, "Requirements for transaction handling":
Also, I think this is related to #6623: that ticket discusses the wording of the error message, and your confusion certainly stemmed from there too.
In terms of process, please assign the ticket to yourself if you're working on a patch.