Applied DictRow "diet" patch

This commit is contained in:
Federico Di Gregorio 2009-05-09 10:19:15 +02:00
parent aecdf33b17
commit 06eb574cec
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2009-05-10 Federico Di Gregorio <fog@initd.org>
* lib/extras.py: applied DictRow "diet" patch from Marko Kreen.
2009-04-21 Federico Di Gregorio <fog@initd.org> 2009-04-21 Federico Di Gregorio <fog@initd.org>
* setup.py: applied patch from Elvis Pranskevichus to make * setup.py: applied patch from Elvis Pranskevichus to make

View File

@ -107,6 +107,8 @@ class DictCursor(DictCursorBase):
class DictRow(list): class DictRow(list):
"""A row object that allow by-colun-name access to data.""" """A row object that allow by-colun-name access to data."""
__slots__ = ('_index',)
def __init__(self, cursor): def __init__(self, cursor):
self._index = cursor.index self._index = cursor.index
self[:] = [None] * len(cursor.description) self[:] = [None] * len(cursor.description)
@ -191,6 +193,9 @@ class RealDictCursor(DictCursorBase):
self._query_executed = 0 self._query_executed = 0
class RealDictRow(dict): class RealDictRow(dict):
__slots__ = ('_column_mapping',)
def __init__(self, cursor): def __init__(self, cursor):
dict.__init__(self) dict.__init__(self)
self._column_mapping = cursor.column_mapping self._column_mapping = cursor.column_mapping