From 2c5a9af76efd93f49eb0757f8c262dbb87d5be43 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Thu, 14 Jul 2011 09:36:35 +0200 Subject: [PATCH 1/2] Fix pickling (again). Unit tests still pass. --- tablib/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tablib/core.py b/tablib/core.py index 7e78b56..eeb319d 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -57,7 +57,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) From 2f8083bda6d78246d41d4cf26f19c5bb447de30f Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Thu, 14 Jul 2011 10:28:12 +0200 Subject: [PATCH 2/2] Fix also __slots__ to ensure proper unpickling --- tablib/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tablib/core.py b/tablib/core.py index eeb319d..4e2d5d6 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -29,7 +29,7 @@ __docformat__ = 'restructuredtext' class Row(object): """Internal Row object. Mainly used for filtering.""" - __slots__ = ['tuple', '_row', 'tags'] + __slots__ = ['_row', 'tags'] def __init__(self, row=list(), tags=list()): self._row = list(row)