Skip to content

Commit 17d8e88

Browse files
committed
fix: import/export under windows.
Export used native \r\n line endings on windows. This results in blank lines when read and Roundup crashes on import. Use \n line endings when writing due to the hard coded \n or \r (but not \r\n) line terminator expected by csv.reader(). Also updates CHANGES.txt to cover this and a the fix for {Otk,Session}.clear() when backed by dumb dbm on windows.
1 parent 5fd5e9c commit 17d8e88

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ Fixed:
119119
incorrect when paginated - correct values are now returned.
120120
(John Rouillard)
121121
- issue2551331 - Fix repeat first/last methods. (John Rouillard)
122+
- Fix import/export on windows. Use unix line terminating characters.
123+
(John Rouillard)
124+
- Fix anydbm session/otks clear() method on windows when backed by
125+
dumbdbm. (John Rouillard)
122126

123127

124128
Features:

roundup/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ class colon_separated(csv.excel):
630630
classname)
631631

632632
with open(os.path.join(export_dir, classname + '.csv'), 'w') as f:
633-
writer = csv.writer(f, colon_separated)
633+
writer = csv.writer(f, colon_separated, lineterminator='\n')
634634

635635
propnames = cl.export_propnames()
636636
fields = propnames[:]
@@ -685,7 +685,7 @@ class colon_separated(csv.excel):
685685
sys.stdout.write("\nExporting Journal for %s\n" %
686686
classname)
687687
sys.stdout.flush()
688-
journals = csv.writer(jf, colon_separated)
688+
journals = csv.writer(jf, colon_separated, lineterminator='\n')
689689
for row in support.Progress(" Writing journals",
690690
cl.export_journals()):
691691
journals.writerow(row)
@@ -1236,7 +1236,7 @@ class colon_separated(csv.excel):
12361236

12371237
# ensure that the properties and the CSV file headings match
12381238
with open(os.path.join(import_dir, file), 'r') as f:
1239-
reader = csv.reader(f, colon_separated)
1239+
reader = csv.reader(f, colon_separated, lineterminator='\n')
12401240
file_props = None
12411241
maxid = 1
12421242
# loop through the file and create a node for each entry
@@ -1260,7 +1260,7 @@ class colon_separated(csv.excel):
12601260

12611261
# import the journals
12621262
with open(os.path.join(import_dir, classname + '-journals.csv'), 'r') as f:
1263-
reader = csv.reader(f, colon_separated)
1263+
reader = csv.reader(f, colon_separated, lineterminator='\n')
12641264
cl.import_journals(reader)
12651265

12661266
# (print to sys.stdout here to allow tests to squash it .. ugh)

0 commit comments

Comments
 (0)