Пример #1
0
def show_page(path='main'):
    page = wiki.get_page(path)
    if not page: abort(404)

    if page.has_key('redirect'):
        return redirect(page['redirect'])
   
    sidenav = wiki.get_page('sidenav')
    if not sidenav: sidenav = {}

    return render_template('show_page.html', sidenav=sidenav, page=page)
Пример #2
0
    def edit(self, path):
        page = wiki.get_page(path)
        if page is None:
            page = {"path": path, "title": "", "content": ""}

        form = EditPageForm(**page)
        if form.validate_on_submit():
            wiki.save_page(form.path.data, form.title.data, form.content.data)
            flash(u"Изменения сохранены", "success")
            return redirect(url_for("show_page", path=page["path"]))

        return self.render("manage/edit_page.html", form=form)