summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-12-10 23:54:08 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-12-10 23:54:25 +0000
commit99bedd1bb2a89b0f7cbd8b175b3752fc150c99bf (patch)
tree2989ed84bc3a59b3a90e8862ccf43fc23d8cc796 /lib/extras.py
parente6fbf47c46881541c69e947245770ddec0c4f70f (diff)
downloadpsycopg2-99bedd1bb2a89b0f7cbd8b175b3752fc150c99bf.tar.gz
Fixed pickling of RealDictRow objects
Diffstat (limited to 'lib/extras.py')
-rw-r--r--lib/extras.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/extras.py b/lib/extras.py
index 22ae3f6..0c4df56 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -245,6 +245,13 @@ class RealDictRow(dict):
name = self._column_mapping[name]
return dict.__setitem__(self, name, value)
+ def __getstate__(self):
+ return (self.copy(), self._column_mapping[:])
+
+ def __setstate__(self, data):
+ self.update(data[0])
+ self._column_mapping = data[1]
+
class NamedTupleConnection(_connection):
"""A connection that uses `NamedTupleCursor` automatically."""