Revision 59
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
41 | 41 |
+' [map_path] [<input] [>output]') |
42 | 42 |
commit = env_flag('commit') |
43 | 43 |
|
44 |
csv_config = dict(delimiter=',', quotechar='"') |
|
45 |
|
|
46 | 44 |
# Load map header |
47 | 45 |
in_is_xml = True |
48 | 46 |
if uses_map: |
... | ... | |
52 | 50 |
import xpath |
53 | 51 |
|
54 | 52 |
map_stream = open(map_path, 'rb') |
55 |
map_reader = csv.reader(map_stream, **csv_config)
|
|
53 |
map_reader = csv.reader(map_stream) |
|
56 | 54 |
src, dest = map_reader.next()[:2] |
57 | 55 |
src, sep, src_base = src.partition('/') |
58 | 56 |
in_is_xml = sep != '' |
... | ... | |
78 | 76 |
dest, None) |
79 | 77 |
if in_is_xml: raise Exception('XML-XML mapping not supported yet') |
80 | 78 |
else: # input is CSV |
81 |
reader = csv.reader(sys.stdin, **csv_config)
|
|
79 |
reader = csv.reader(sys.stdin) |
|
82 | 80 |
fieldnames = reader.next() |
83 | 81 |
row_idx = 0 |
84 | 82 |
for row in reader: |
Also available in: Unified diff
map: Added support for custom fkeys to parent in db XML trees. Removed extraneous csv reader/writer config because Excel format is default. Improved documentation.