Project

General

Profile

« Previous | Next » 

Revision 1739

join: Also produce warnings for no input mapping (if no comment explaining why no input mapping), in addition to no join mapping

View differences:

bin/join
35 35
        +'" doesn\'t match map 1 input column name "'+map_1_cols[0]+'"')
36 36
    writer.writerow(maps.merge_mappings(map_0_cols, map_1_cols))
37 37
    for row in reader:
38
        def set_error(msg):
39
            warnings.warn(UserWarning(msg))
40
            row[2] = '** '+msg+' ** '+util.list_setdefault(row, 2, '')
41
            row[1] = ''
42
        
38 43
        if row[1] != '':
39 44
            out_orig = row[1] # used in "No join mapping" error msg
40 45
            
......
58 63
            if out_row != None:
59 64
                row = maps.merge_mappings(row, out_row)
60 65
                if row[1] != '': row[1] += suffix # don't modify out_row!
61
            else:
62
                msg = 'No join mapping for '+out_orig
63
                warnings.warn(UserWarning(msg))
64
                row[2] = '** '+msg+' ** '+util.list_setdefault(row, 2, '')
65
                row[1] = ''
66
            else: set_error('No join mapping for '+out_orig)
67
        elif row[2] == '': # also no comment explaining why no input mapping
68
            set_error('No input mapping for '+row[0])
69
        
66 70
        writer.writerow(row)
67 71

  
68 72
main()

Also available in: Unified diff