Python
10 Oct 2008 HTML Text
 
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def save_start_time(stime):
    row = conn.execute(notify_logs.select().\
        where(notify_logs.c.type == 'spooler')).fetchone()
    if row is None:
        conn.execute(notify_logs.insert(values={'type': 'spooler', 'time': stime}))
        logging.error('inserting to db the stime: %s' % stime)
    else:
        r = conn.execute(notify_logs.update(notify_logs.c.type == 'spooler',
            values={'time': stime}))
        logging.error('updating to db the stime: %s' % stime)