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
(grafted from c07aae86c7fe87715994f0e82177980b9907dc3f)

--HG--
branch : 6.0
This commit is contained in:
Adrià Tarroja Caubet committed 2025-03-26 18:09:18 +01:00
1 parent 98ae81a74f
commit e9cc5f2f15
1 file changed
+1 -1
+1 -1
View File
@@ -458,7 +458,7 @@ class Form(SignalEvent, 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)
writer.writerow(fields)
for row, path in zip_longest(data, paths or []):