1. Atsushi Odagiri
  2. crosswiki

Source

crosswiki / crosswiki / views.py

from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from .models import Page
from .helpers import page_url

def show_page(request):
    page_name = request.matchdict['page_name']
    page = Page.query.filter_by(page_name=page_name)
    return dict(page_name=page.page_name, content=page.html_content)

def create_page(request):
    page = Page(page_name=request.matchdict['page_name'],
        content=request.params['content'])
    request.context.add(page)

    return HTTPFound(location=page_url(request, page))