Project

General

Profile

« Previous | Next » 

Revision 2666

sql.py: run_query(): Only pass non-None debug_msg_ref to DbConn.run_query() if filtering with log_ignore_excs or can't mogrify() (and therefore can't print queries before they're run)

View differences:

lib/sql.py
383 383
    if log_ignore_excs == None: log_ignore_excs = ()
384 384
    log_ignore_excs = tuple(log_ignore_excs)
385 385
    
386
    debug_msg_ref = [None]
386
    debug_msg_ref = None # usually, db.run_query() logs query before running it
387
    # But if filtering with log_ignore_excs, wait until after exception parsing
388
    if log_ignore_excs != () or not db.can_mogrify(): debug_msg_ref = [None] 
389
    
387 390
    try:
388 391
        try:
389 392
            def run(): return run_raw_query(db, query, params, cacheable,
......
431 434
        log_level += 2
432 435
        raise
433 436
    finally:
434
        if debug_msg_ref[0] != None: db.log_debug(debug_msg_ref[0], log_level)
437
        if debug_msg_ref != None and debug_msg_ref[0] != None:
438
            db.log_debug(debug_msg_ref[0], log_level)
435 439

  
436 440
##### Basic queries
437 441

  

Also available in: Unified diff