예제 #1
0
파일: webserver.py 프로젝트: BwRy/ptnotes
def delete_project(pid):
    """
    Delete the specified project.
    """
    pdb = database.ProjectDatabase()
    project = pdb.delete_project(pid)

    return flask.redirect(flask.url_for('projects'))
예제 #2
0
파일: webserver.py 프로젝트: BwRy/ptnotes
def get_project_db(pid):
    """
    Get our project database.
    """
    pdb = database.ProjectDatabase()
    project = pdb.get_project(pid)

    if project is None:
        flask.abort(404)

    return project
예제 #3
0
파일: webserver.py 프로젝트: l50/ptnotes
def project_notes(pid):
    """
    Display all project notes.
    """
    pdb = database.ProjectDatabase()
    project = get_project_db(pid)

    if flask.request.method == 'POST':
        note = flask.request.form['note']
        pdb.update_project_note(pid, note)

        return flask.redirect(flask.url_for('get_project', pid=pid))
    else:
        return flask.render_template('project_notes.html',
                                     pid=pid,
                                     name=project['name'],
                                     note=project['note'])
예제 #4
0
파일: webserver.py 프로젝트: BwRy/ptnotes
def projects():
    """
    Get a list of all projects.
    """
    pdb = database.ProjectDatabase()
    stats = {}

    if flask.request.method == 'POST':
        name = flask.request.form['project_name']
        pdb.create_project(name)

    project_list = pdb.get_projects()
    for project in project_list:
        db = database.ScanDatabase(project['dbfile'])
        stats[project['id']] = db.get_stats()

    return flask.render_template('projects.html',
                                 projects=project_list,
                                 stats=stats)