Commit 8855ea3
bosd
Fix: Abort import process immediately on malformed CSV files
The import process failed to abort when a CSV file was malformed,
leading to a subsequent and misleading "read operation timed out" error.
This was due to a flawed error-handling flow.
The problem stemmed from the sort_for_self_referencing function in
sort.py, which was returning None for both "file not found" and
"malformed CSV" errors. The self_referencing_check function in
preflight.py incorrectly interpreted this None return value as "no
hierarchy detected," allowing the import to proceed despite the critical
file-read failure.
This change modifies the error-handling flow to correctly distinguish
between a successful state and a failure:
sort_for_self_referencing now returns False for a file read error,
None when no sorting is required, and a file path on successful
sort.
self_referencing_check is updated to correctly handle these return
values, returning False (and aborting the import) when a file read
error is detected.
This fix ensures that malformed CSV files will now properly and
immediately abort the import process with a clear error message,
preventing confusing downstream failures. All 370 tests have been
updated and are passing, confirming the fix works as expected.1 parent 448b388 commit 8855ea3
File tree
4 files changed
+20
-9
lines changed- src/odoo_data_flow/lib
- tests
4 files changed
+20
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| 130 | + | |
124 | 131 | | |
| 132 | + | |
125 | 133 | | |
126 | | - | |
| 134 | + | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
37 | | - | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
0 commit comments