def init_app(): app = create_app() store = get_store() store.execute("CREATE TABLE person " "(id INTEGER PRIMARY KEY, name VARCHAR)") store.commit() store.close()
def save_view(req): form = PersonForm(req.form) if req.method == 'POST' and form.validate(): store = get_store() p = Person() form.auto_populate(p) store.add(p) store.commit() return redirect('/')
def main_view(req): s = get_store() return render_response('index.jinja', persons=s.find(Person).order_by('name'))