Revision 835
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
119 | 119 |
log_done(debug) |
120 | 120 |
if value != None: xpath.put_obj(root, out, row_id, |
121 | 121 |
has_types, strings.cleanup(value)) |
122 |
process_row(row) |
|
122 |
process_row(i, row)
|
|
123 | 123 |
sys.stderr.write('Processed '+str(i+1)+' input rows\n') |
124 | 124 |
|
125 | 125 |
if map_path == None: |
126 | 126 |
iter_ = xml_dom.NodeElemIter(doc0.documentElement) |
127 | 127 |
util.skip(iter_, xml_dom.is_text) # skip metadata |
128 |
for child in iter_:
|
|
128 |
for i, child in enumerate(iter_):
|
|
129 | 129 |
root.appendChild(child) |
130 |
process_row(child) |
|
130 |
process_row(i, child)
|
|
131 | 131 |
elif in_is_db: |
132 | 132 |
assert in_is_xpaths |
133 | 133 |
|
... | ... | |
190 | 190 |
if test: sql.empty_db(out_db) |
191 | 191 |
row_ct_ref = [0] |
192 | 192 |
|
193 |
def process_row(input_row): |
|
193 |
def process_row(row_num, input_row):
|
|
194 | 194 |
def on_error(e): |
195 |
exc.add_msg(e, term.emph('row #:')+' '+str(row_num)) |
|
195 | 196 |
exc.add_msg(e, term.emph('input row:')+'\n'+str(input_row)) |
196 | 197 |
exc.add_msg(e, term.emph('output row:')+'\n'+str(root)) |
197 | 198 |
ex_tracker.track(e) |
... | ... | |
214 | 215 |
out_db.close() |
215 | 216 |
else: |
216 | 217 |
def on_error(e): ex_tracker.track(e) |
217 |
def process_row(input_row): pass |
|
218 |
def process_row(row_num, input_row): pass
|
|
218 | 219 |
process_inputs(root, process_row) |
219 | 220 |
xml_func.process(root, on_error) |
220 | 221 |
if out_is_xml_ref[0]: |
Also available in: Unified diff
bin/map: Print row # of rows with errors