1
0
mirror of https://github.com/django/django.git synced 2024-11-18 07:26:04 +00:00

Replaced Oracle CursorIterator with generator expression.

This commit is contained in:
Sergey Fedoseev 2017-07-14 14:15:00 +05:00
parent 37b2602c89
commit 18db55bb31

View File

@ -524,23 +524,7 @@ class FormatStylePlaceholderCursor:
return getattr(self.cursor, attr)
def __iter__(self):
return CursorIterator(self.cursor)
class CursorIterator:
"""
Cursor iterator wrapper that invokes our custom row factory.
"""
def __init__(self, cursor):
self.cursor = cursor
self.iter = iter(cursor)
def __iter__(self):
return self
def __next__(self):
return _rowfactory(next(self.iter), self.cursor)
return (_rowfactory(r, self.cursor) for r in self.cursor)
def _rowfactory(row, cursor):