diff options
| author | Mark Walling <mark@markwalling.org> | 2011-07-01 17:51:43 -0400 |
|---|---|---|
| committer | Mark Walling <mark@markwalling.org> | 2011-07-01 17:53:38 -0400 |
| commit | 6313437a27d68e42247802f7f68ec3270cb9a2da (patch) | |
| tree | 0537dcd14c57a2f3fa88578d5fbf51a992a74c2c /tablib/core.py | |
| parent | d254c2d2b02b026d08cef01475d16fcc51e763ec (diff) | |
| download | tablib-6313437a27d68e42247802f7f68ec3270cb9a2da.tar.gz | |
Added support for detecting unicode column headers
Also added tests!
Fix for kennethreitz#26
Diffstat (limited to 'tablib/core.py')
| -rw-r--r-- | tablib/core.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tablib/core.py b/tablib/core.py index 53f3767..00e55af 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -162,7 +162,7 @@ class Dataset(object): def __getitem__(self, key): - if isinstance(key, str): + if isinstance(key, str) or isinstance(key, unicode): if key in self.headers: pos = self.headers.index(key) # get 'key' index from each data return [row[pos] for row in self._data] @@ -182,7 +182,7 @@ class Dataset(object): def __delitem__(self, key): - if isinstance(key, str): + if isinstance(key, str) or isinstance(key, unicode): if key in self.headers: @@ -730,7 +730,7 @@ class Dataset(object): sorted. """ - if isinstance(col, str): + if isinstance(col, str) or isinstance(col, unicode): if not self.headers: raise HeadersNeeded |
