diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2010-10-04 11:33:16 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2010-10-04 11:33:16 -0400 |
| commit | a8b0bf4b5fc680ab7165d77d69eb976bcd339d09 (patch) | |
| tree | cb155d551e1b32a2f431f41d678c5e7a651a1f4d /tablib | |
| parent | 6574d3e58bfcf55305420346a7d7028614b55839 (diff) | |
| download | tablib-a8b0bf4b5fc680ab7165d77d69eb976bcd339d09.tar.gz | |
Typo.
Diffstat (limited to 'tablib')
| -rw-r--r-- | tablib/core.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tablib/core.py b/tablib/core.py index 1214f99..e7b622c 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -22,7 +22,7 @@ class Dataset(object): self.__headers = None # ('title', index) tuples - self._seperators = [] + self._separators = [] try: self.headers = kwargs['headers'] @@ -36,6 +36,7 @@ class Dataset(object): self._register_formats() + def __len__(self): return self.height @@ -197,24 +198,26 @@ class Dataset(object): self._data = [tuple([row]) for row in col] - def insert_seperator(self, index, text='-'): - """Adds a seperator to Dataset at given index.""" + def insert_separator(self, index, text='-'): + """Adds a separator to Dataset at given index.""" - if self.height >= index: - sep = (index, text) - self._seperators.append(sep) - else: - raise InvalidDimensions + sep = (index, text) + self._separators.append(sep) - def append_seperator(self, text='-'): - """Adds a seperator to Dataset.""" - - index = self.height if self.headers else (self.height - 1) - self.insert_seperator(index, text) + def append_separator(self, text='-'): + """Adds a separator to Dataset.""" + + # change offsets if headers are or aren't defined + if not self.headers: + index = self.height if self.height else 0 + else: + index = (self.height + 1) if self.height else 1 + + self.insert_separator(index, text) - def insert(self, i, row=None, col=None): + def insert(self, i, row=None): """Inserts a row at given position in Dataset""" if row: self._validate(row) |
