diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2010-11-04 04:20:45 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2010-11-04 04:20:45 -0400 |
| commit | 5c747c9c2e7c9920ea495e64bad4009e9ee99b3e (patch) | |
| tree | 3096c6797319d55362a0e7a3896435d6f67b5141 /tablib | |
| parent | 0bbd990ed8aae827be2a04100def9e8401f8ac99 (diff) | |
| download | tablib-5c747c9c2e7c9920ea495e64bad4009e9ee99b3e.tar.gz | |
Keepin' it DRY.
Diffstat (limited to 'tablib')
| -rw-r--r-- | tablib/core.py | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/tablib/core.py b/tablib/core.py index d1a574d..9f5ffc4 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -442,26 +442,9 @@ class Dataset(object): """ if row is not None: - self._validate(row) - self._data.append(Row(row, tags=tags)) + self.insert(self.height, row=row, tags=tags) elif col is not None: - col = self._clean_col(col) - - self._validate(col=col) - - if self.headers: - # pop the first item off, add to headers - self.headers.append(col[0]) - col = col[1:] - - if self.height and self.width: - - for i, row in enumerate(self._data): - row.append(col[i]) - self._data[i] = row - else: - self._data = [Row([row]) for row in col] - + self.insert(self.width, col=col) def insert_separator(self, index, text='-'): """Adds a separator to :class:`Dataset` at given index.""" @@ -501,7 +484,7 @@ class Dataset(object): """ if row: self._validate(row) - self._data.insert(i, Row(row, tags=tags)) + self._data.insert(index, Row(row, tags=tags)) elif col: col = self._clean_col(col) |
