Description

I have a simple test view decorated with a transaction.commit_manually. The view does only a few database (MySQL) reads. Before returning I do a transaction.commit() and surely the call to transaction.is_dirty() returns False.

A further test with all database reads removed yields the same result.

Change History (2)

Sounds like you've been tripped up by r15493. However, since you haven't provided any details that would allow us to reproduce your problem, I can't confirm or deny this.

If you are reporting a problem, you need to provide enough detail for someone else to reproduce the problem *exactly*. It's no good giving vague descriptions -- we need specific code samples, or at the very least, precise instructions that will allow someone else to reproduce the problem you are seeing.

Closing invalid. Please reopen if you can provide the necessary detail.

Sounds like you've been tripped up by r15493. However, since you haven't provided any details that would allow us to reproduce your problem, I can't confirm or deny this.

If you are reporting a problem, you need to provide enough detail for someone else to reproduce the problem *exactly*. It's no good giving vague descriptions -- we need specific code samples, or at the very least, precise instructions that will allow someone else to reproduce the problem you are seeing.

Closing invalid. Please reopen if you can provide the necessary detail.

and it failed in my environment with the TransactionManagementError exception. When trying to further minimize the example for the purpose of reopening this ticket, I removed the call to RequestContext like so:

and then the view passed.
It turned out that I have a custom context processor which accesses the database to determine the menu functions available to the logged on user thus dirtying the transaction. I now do a conditional transaction.commit() in the context processor:

There is one more candidate case to be mentioned in the docs: database accesses from within a template. If the corresponding view is transaction.commit_manually decorated then TemplateResponse and a post-render callback with transaction commit or rollback in it seem to come handy.