diff options
| author | Benjamin Wohlwend <benjamin.wohlwend@divio.ch> | 2011-02-14 10:06:02 +0100 |
|---|---|---|
| committer | Benjamin Wohlwend <benjamin.wohlwend@divio.ch> | 2011-02-14 10:06:02 +0100 |
| commit | 9cac54eefc703c0a7cb09e201c4ca032e9fb19c9 (patch) | |
| tree | 7fd64b90a40e2c88b3cd809424a88b169b1fb2d0 | |
| parent | f69a96f07eb23323a0574306d0a673860cffe536 (diff) | |
| download | tablib-9cac54eefc703c0a7cb09e201c4ca032e9fb19c9.tar.gz | |
Python 2.5 doesn't support @property.setter
| -rw-r--r-- | tablib/core.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tablib/core.py b/tablib/core.py index 5b224a0..a42f1f8 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -54,7 +54,7 @@ class Row(object): del self._row[i] def __getstate__(self): - return {slot: getattr(self, slot) for slot in self.__slots__} + return {slot: [getattr(self, slot) for slot in self.__slots__]} def __setstate__(self, state): for (k, v) in state.items(): setattr(self, k, v) @@ -280,8 +280,7 @@ class Dataset(object): return 0 - @property - def headers(self): + def _get_headers(self): """An *optional* list of strings to be used for header rows and attribute names. This must be set manually. The given list length must equal :class:`Dataset.width`. @@ -290,8 +289,7 @@ class Dataset(object): return self.__headers - @headers.setter - def headers(self, collection): + def _set_headers(self, collection): """Validating headers setter.""" self._validate(collection) if collection: @@ -302,9 +300,9 @@ class Dataset(object): else: self.__headers = None + headers = property(_get_headers, _set_headers) - @property - def dict(self): + def _get_dict(self): """A JSON representation of the :class:`Dataset` object. If headers have been set, a JSON list of objects will be returned. If no headers have been set, a JSON list of lists (rows) will be returned instead. @@ -318,8 +316,7 @@ class Dataset(object): return self._package() - @dict.setter - def dict(self, pickle): + def _set_dict(self, pickle): """A native Python representation of the Dataset object. If headers have been set, a list of Python dictionaries will be returned. If no headers have been set, a list of tuples (rows) will be returned instead. @@ -348,6 +345,9 @@ class Dataset(object): else: raise UnsupportedFormat + dict = property(_get_dict, _set_dict) + + @property def xls(): """An Excel Spreadsheet representation of the :class:`Dataset` object, with :ref:`seperators`. Cannot be set. |
