0001-misc-keep-newlines-in-CSV-import-42624.patch
tests/test_backoffice_pages.py | ||
---|---|---|
6354 | 6354 | |
6355 | 6355 |
data = [b'Table,Map,Test,Boolean,List,Date,File,Email,Long,List2'] |
6356 | 6356 |
for i in range(1, 150): |
6357 |
data.append(b'table,48.81;2.37,data%d ,%s,item%d,2020-01-%02d,filename-%d,test@localhost,plop,1' % (
|
|
6357 |
data.append(b'table,48.81;2.37,data%d ,%s,item%d,2020-01-%02d,filename-%d,test@localhost,"plop\nplop",1' % (
|
|
6358 | 6358 |
i, str(bool(i % 2)).encode('utf-8'), i, i % 31 + 1, i)) |
6359 | 6359 | |
6360 | 6360 |
resp.forms[0]['file'] = Upload('test.csv', b'\n'.join(data), |
... | ... | |
6368 | 6368 |
assert card1.data['2'] == 'data1' |
6369 | 6369 |
assert card1.data['3'] is True |
6370 | 6370 |
assert card1.data['5'].tm_mday == 2 |
6371 |
assert card1.data['9'] == 'plop\nplop' |
|
6371 | 6372 |
assert card1.data['10'] == '1' |
6372 | 6373 |
assert card1.data['10_display'] == 'un' |
6373 | 6374 |
assert card1.data['10_structured'] == {'id': '1', 'text': 'un', 'more': 'foo'} |
wcs/backoffice/data_management.py | ||
---|---|---|
224 | 224 |
except csv.Error: |
225 | 225 |
dialect = None |
226 | 226 | |
227 |
reader = csv.reader(content.splitlines(), dialect=dialect) |
|
227 |
reader = csv.reader(content.splitlines(keepends=True), dialect=dialect)
|
|
228 | 228 |
try: |
229 | 229 |
caption = next(reader) |
230 | 230 |
except StopIteration: |
231 |
- |