- if request.method != 'POST' or not c.write_post_form.validate():
- # Failure or initial request; show the form
- return render('/forum/write.mako')
+ @authenticate_form
+ def write_commit(self, forum_id, thread_id):
+ """Post to a thread."""
+ if not c.user.can('forum:create-post'):
+ abort(403)
+
+ try:
+ c.thread = meta.Session.query(forum_model.Thread) \
+ .filter_by(id=thread_id, forum_id=forum_id).one()
+ except NoResultFound:
+ abort(404)