Revision 859
Added by Aaron Marcuse-Kubitza almost 13 years ago
bin/map | ||
---|---|---|
48 | 48 |
test = opts.env_flag('test') |
49 | 49 |
commit = not test and opts.env_flag('commit') # never commit in test mode |
50 | 50 |
debug = opts.env_flag('debug') |
51 |
sql.run_raw_query.debug = debug |
|
51 | 52 |
verbose = debug or opts.env_flag('verbose') |
52 | 53 |
|
53 | 54 |
# Logging |
54 | 55 |
def log(msg, on=verbose): |
55 | 56 |
if on: sys.stderr.write(msg) |
56 |
def log_start(action, on=verbose): log(action+'...', on) |
|
57 |
def log_done(on=verbose): log('Done\n', on) |
|
57 |
def log_start(action, on=verbose): log(action+'...\n', on) |
|
58 | 58 |
|
59 | 59 |
# Parse args |
60 | 60 |
map_paths = sys.argv[1:] |
... | ... | |
65 | 65 |
def connect_db(db_config): |
66 | 66 |
log_start('Connecting to '+sql.db_config_str(db_config)) |
67 | 67 |
db = sql.connect(db_config) |
68 |
log_done() |
|
69 | 68 |
return db |
70 | 69 |
|
71 | 70 |
out_is_xml_ref = [False] |
... | ... | |
131 | 130 |
if value == None: |
132 | 131 |
log_start('Getting '+str(in_), debug) |
133 | 132 |
value = get_value(in_, row) |
134 |
log_done(debug) |
|
135 | 133 |
if value != None: xpath.put_obj(root, out, row_id, |
136 | 134 |
has_types, strings.cleanup(value)) |
137 | 135 |
process_rows(process_row, rows) |
Also available in: Unified diff
bin/map: Don't print Done after an action in debug logging mode because it messes up newlines when more debugging info is printed right after it