Open CSV export file using with newline translation

The csv documentation [1] explains that file object used in writer should be
opened with newline as empty string.

[1] https://docs.python.org/3/library/csv.html

Closes #12115
This commit is contained in:
Adrià Tarroja Caubet
2025-03-26 18:09:18 +01:00
parent 453c79ff15
commit b968ece9a7
+1 -1
View File
@@ -435,7 +435,7 @@ class Form(TabContent):
delimiter = ';'
fileno, fname = tempfile.mkstemp(
'.csv', common.slugify(export['name']) + '_')
with open(fname, 'w') as fp:
with open(fname, 'w', newline='') as fp:
writer = csv.writer(fp, delimiter=delimiter)
for row, path in zip_longest(data, paths or []):
indent = len(path) - 1 if path else 0