Opened 17 years ago
Closed 17 years ago
#5883 closed (fixed)
CursorDebugWrapper should implement __iter__
Reported by: | eibaan | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to PEP 249, a database cursor can be iterable. The CursorDebugWrapper however cannot correctly delegate this. To fix this, a method
def __iter__(self): return iter(self.cursor)
added to that class enables support for cursor iteration if DEBUG is enabled. This method should be added to django/db/backends/utils.py
.
Attachments (1)
Change History (5)
by , 17 years ago
comment:1 by , 17 years ago
Has patch: | set |
---|
The logical thing to do would be to make all cursors iterable.
The postgresql backend uses a UnicodeCursorWrapper which isn't iterable around a psycopg1 cursor; all other backends have iterable cursors.
The patch fixes both issues.
comment:2 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 17 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
patch