def page_view(request): slug = request.matchdict['slug'] page = Page.fetch(slug) if page is None or page.body == '': request.override_renderer = 'under_construction.mako' return {} return { 'page': page }
def edit_page_view(request): slug = request.matchdict['slug'] page = Page.fetch(slug) saveUrl = request.route_path('edit_page', slug=slug) if 'body' in request.params: page.body = request.params['body'] page.update() request.session.flash(u'<div class="ok">Page updated!</div>') return HTTPFound(saveUrl) return { 'page': page, 'save_url': saveUrl, }
def dashboard_view(request): return { 'pages': Page.fetchAll(), 'settings': Setting.fetch_all() }