Revision 3777
Added by Aaron Marcuse-Kubitza over 12 years ago
bin/join | ||
---|---|---|
42 | 42 |
row[2] = '** '+msg+' ** '+util.list_setdefault(row, 2, '') |
43 | 43 |
row[1] = '' |
44 | 44 |
|
45 |
row_written = False |
|
45 | 46 |
if row[1] != '': |
46 | 47 |
out_orig = row[1] # used in "No join mapping" error msg |
47 | 48 |
|
... | ... | |
65 | 66 |
is_empty = len(out_rows) == 1 and out_rows[0][1] == '' |
66 | 67 |
if out_rows and not is_empty: # found non-empty mapping(s) |
67 | 68 |
for out_row in out_rows: |
68 |
row = maps.merge_mappings(row, out_row) |
|
69 |
if row[1] != '': row[1] += suffix # don't modify out_row! |
|
69 |
row_ = row[:] # don't modify row, since it will be reused |
|
70 |
row_ = maps.merge_mappings(row_, out_row) |
|
71 |
if row_[1] != '': row_[1] += suffix # don't modify out_row! |
|
72 |
writer.writerow(row_) |
|
73 |
row_written = True |
|
70 | 74 |
else: |
71 | 75 |
msg = 'No' |
72 | 76 |
if is_empty: msg += ' non-empty' |
... | ... | |
75 | 79 |
elif row[2] == '': # also no comment explaining why no input mapping |
76 | 80 |
set_error('No input mapping for '+row[0]) |
77 | 81 |
|
78 |
writer.writerow(row) |
|
82 |
if not row_written: writer.writerow(row)
|
|
79 | 83 |
|
80 | 84 |
main() |
Also available in: Unified diff
join: Fixed bug where when an input to mapped to multiple outputs, the joined row for each output needed to be output separately using writer.writerow()