コード例 #1
0
def is_processed(filepath):
    query = """select * from filelog where filename = ?"""
    c = conn.cursor()
    r = c.execute(query, (compat.decode(filepath), ))
    if len(r.fetchall()):
        return True
    else:
        return False
コード例 #2
0
def is_processed(filepath):
    query = """select * from filelog where filename = ?"""
    c = conn.cursor()
    r = c.execute(query, (compat.decode(filepath), ))
    if len(r.fetchall()):
        return True
    else:
        return False
コード例 #3
0
def get_processed_status(filepath):
    query = """select reason from filelog where filename = ?"""
    c = conn.cursor()
    r = c.execute(query, (compat.decode(filepath), ))
    row = r.fetchone()
    if row:
        reason = row[0]
        # An empty `reason` field means that it was successful
        if reason is None:
            colour, reason = GREEN, ":) done"
        else:
            # The status is only 10 chars wide (3 for smile) so we
            # chop the status text to 7
            colour = RED
            reason = ":( %s" % reason[:7]
        return True, (colour, reason)
    else:
        return False, None
コード例 #4
0
def add_to_filelist(filepath, reason=None):
    query = """insert into filelog(filename, reason) values(?, ?)"""
    c = conn.cursor()
    c.execute(query, (compat.decode(filepath), reason))
    conn.commit()
コード例 #5
0
def add_to_filelist(filepath, reason=None):
    query = """insert into filelog(filename, reason) values(?, ?)"""
    c = conn.cursor()
    c.execute(query, (compat.decode(filepath), reason))
    conn.commit()