Esempio n. 1
0
def add_paste(poster, title, body, fmt):
    """
    Create a new paste.
    """
    dbkit.execute("""
        INSERT INTO pastes (
            poster, title, body, syntax
        ) VALUES (
            ?, ?, ?, ?
        )
        """, (poster, title, body, fmt))
    return dbkit.last_row_id()
Esempio n. 2
0
def add_comment(paste_id, poster, body):
    """
    Attach a comment to a paste.
    """
    dbkit.execute("""
        INSERT INTO comments (
            paste_id, poster, body
        ) VALUES (
            ?, ?, ?
        )
        """, (paste_id, poster, body))
    return dbkit.last_row_id()
Esempio n. 3
0
def add_paste(poster, title, chunks):
    """
    Create a new paste.
    """
    dbkit.execute("""
        INSERT INTO pastes (poster, title) VALUES (?, ?)
        """, (poster, title))
    paste_id = dbkit.last_row_id()
    for body, syntax in chunks:
        dbkit.execute("""
            INSERT INTO chunks (paste_id, body, syntax) VALUES (?, ?, ?)
            """, (paste_id, body, syntax))
    return paste_id
Esempio n. 4
0
def save_note(project_id, note):
    dbkit.execute("""
        INSERT INTO notes (project_id, note) VALUES (?, ?)
        """, (project_id, note))
    return dbkit.last_row_id()
Esempio n. 5
0
def add_project(project):
    slug = slugify(project)
    dbkit.execute("""
        INSERT INTO projects (project, slug, overview) VALUES (?, ?, '')
        """, (project, slug))
    return (dbkit.last_row_id(), slug)