def report(id): r = reports.find_by_id(id) if not r: abort(404) recent_reports = reports.recent() return render_template('report.html', report=r, recent_reports=recent_reports)
def edit_report(id=None): r = reports.find_by_id(id) if id is not None else None if r and not r.can_edit_by(g.user): abort(403) if request.method == 'GET': return render_template('report_edit.html', report=r) # post action = request.form['action'] if action == u'投稿': return post_report(r) elif action == u'削除': return delete_report(r) abort(400)