Added missing dict methods in DictRow

This commit is contained in:
Federico Di Gregorio 2009-04-19 16:25:12 +02:00
parent bd19e3148c
commit bb77a6912f
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-04-19 Federico Di Gregorio <fog@initd.org>
* lib/extras.py: patch from Marko Kreen to implement missing dict
methods in DictRow.
2009-04-04 Federico Di Gregorio <fog@initd.org>
* connection_int.c(conn_notice_callback): removed all Python

View File

@ -141,6 +141,17 @@ class DictRow(list):
for n, v in self._index.items():
yield n, list.__getitem__(self, v)
def iterkeys(self):
return self._index.iterkeys()
def itervalues(self):
return list.__iter__(self)
def copy(self):
return dict(self.items())
def __contains__(self, x):
return self._index.__contains__(x)
class RealDictConnection(_connection):
"""A connection that uses RealDictCursor automatically."""