diff options
| author | Kenneth Reitz <me@kennethreitz.org> | 2016-02-07 08:09:10 -0500 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.org> | 2016-02-07 08:09:10 -0500 |
| commit | 53d69bd3ea658a7ea2146589f4d0a9207a19cd26 (patch) | |
| tree | dacf2c92a2b1e05ab292504a291cb868f69245ff | |
| parent | fcc9700d11e337947e0a99a9c10831615ef2005f (diff) | |
| download | tablib-53d69bd3ea658a7ea2146589f4d0a9207a19cd26.tar.gz | |
fix __unicode__
| -rw-r--r-- | tablib/core.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tablib/core.py b/tablib/core.py index 808c005..7deb277 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -220,12 +220,15 @@ class Dataset(object): return '<dataset object>' def __unicode__(self): - result = [self.__headers] + result = [] + # Add unicode representation of headers. + result.append([unicode(h) for h in self.__headers]) + + # Add unicode representation of rows. result.extend(list(map(unicode, row)) for row in self._data) - # here, we calculate max width for each column - lens = (list(map(len, row)) for row in result) + lens = [list(map(len, row)) for row in result] field_lens = list(map(max, zip(*lens))) # delimiter between header and data |
