summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2011-05-12 10:13:42 -0400
committerKenneth Reitz <me@kennethreitz.com>2011-05-12 10:14:39 -0400
commit2cd381389cb330f57c212eaa2ba233610cf0bbfa (patch)
tree9cd8848a366cc8e5381815af8cdda0d00550985d
parent0ebc8f5e1b4fff9822128314b48911b95b9a0e28 (diff)
downloadtablib-2cd381389cb330f57c212eaa2ba233610cf0bbfa.tar.gz
Merge pull request #8 from cswegger/tablib
--- This pull request is to fix pickling / unpickling of Row within Dataset. __getstate__ resembled a dictionary comprehension (Python 2.7+) but it wasnt, and it caused wrong values to be pickled, leading to unusable objects after restoring. This patch fixes the issues. All unit tests still pass.
-rw-r--r--HISTORY.rst6
-rw-r--r--tablib/core25.py11
2 files changed, 15 insertions, 2 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index f545a4a..22437ca 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,12 @@
History
-------
+0.9.7
++++++
+
+* Pickling Bugfix
+
+
0.9.6 (2011-05-12)
++++++++++++++++++
diff --git a/tablib/core25.py b/tablib/core25.py
index c8352a6..800cae3 100644
--- a/tablib/core25.py
+++ b/tablib/core25.py
@@ -35,7 +35,7 @@ __docformat__ = u'restructuredtext'
class Row(object):
u"""Internal Row object. Mainly used for filtering."""
- __slots__ = [u'tuple', u'_row', u'tags']
+ __slots__ = [ u'_row', u'tags']
def __init__(self, row=list(), tags=list()):
self._row = list(row)
@@ -63,7 +63,14 @@ class Row(object):
del self._row[i]
def __getstate__(self):
- return {slot: [getattr(self, slot) for slot in self.__slots__]}
+
+ slots = dict()
+
+ for slot in self.__slots__:
+ attribute = getattr(self, slot)
+ slots[slot] = attribute
+
+ return slots
def __setstate__(self, state):
for (k, v) in list(state.items()): setattr(self, k, v)