def append_links(): page_path = 'Links' page = WikiPage(page_path) if not page.append(request.args.get('link')): # Storing would fail if something unrecoverable happened. abort(500) app.search_engine.update_wiki(page_path, request.args.get('link')) return redirect(url_for('wiki', page_path=page_path))
def append_wiki(): '''Update a wiki page.''' # If the path changed, then this is now a new page. if request.form['original_page_path'] != request.form['page_path']: return make_wiki() else: # Because the path is the same as the original, then it must be valid # because it is a pre-existing page. page_path = request.form['page_path'] page = WikiPage(page_path) if not page.append(request.form['wiki_content']): # Storing would fail if something unrecoverable happened. abort(500) app.search_engine.update_wiki(page_path, request.form['wiki_content']) return redirect(url_for('wiki', page_path=page_path))