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)

5883.diff (953 bytes ) - added by arien <regexbot@…> 17 years ago.
patch

Download all attachments as: .zip

Change History (5)

by arien <regexbot@…>, 17 years ago

Attachment: 5883.diff added

patch

comment:1 by arien <regexbot@…>, 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 Thomas Güttler, 17 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Thomas Güttler, 17 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [7259]) Fixed #5883 -- Added iter methods to the debug cursor and the postgresql backend cursor.

Note: See TracTickets for help on using tickets.
Back to Top