Opened 18 years ago
Closed 18 years ago
#3024 closed defect (fixed)
[patch] db backend _commit/_rollback check connection
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The _commit and _rollback methods in the DB backends should both check if self.connection is not None. This patch does just that.
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | check_connection_for_none.diff added |
---|
comment:1 by , 18 years ago
Needs tests: | set |
---|
comment:2 by , 18 years ago
The connection is initialized with None. If you immediately call _commit() without calling cursor(), the connection will not be initialized.
Here is a simple code path that would trigger the error:
$ python manage.py shell from django.db import transaction transaction.enter_transaction_management() transaction.commit()
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Pardon my ignorance, under which circumstances is self.connection == None?