import logging
from pylons import config, request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect_to
+from pylons.controllers.util import abort, redirect
from routes import request_config
from sqlalchemy.orm.exc import NoResultFound
import wtforms
return render('/forum/forums.mako')
def threads(self, forum_id):
- try:
- c.forum = meta.Session.query(forum_model.Forum).get(forum_id)
- except NoResultFound:
+ c.forum = meta.Session.query(forum_model.Forum).get(forum_id)
+ if not c.forum:
abort(404)
c.write_thread_form = WriteThreadForm()
# Redirect to the new thread
h.flash("Contribution to the collective knowledge of the species successfully recorded.")
- redirect_to(controller='forum', action='posts',
- forum_id=forum_id, thread_id=thread.id,
- _code=303)
+ redirect(
+ url(controller='forum', action='posts',
+ forum_id=forum_id, thread_id=thread.id),
+ code=303,
+ )
def write(self, forum_id, thread_id):
"""Provides a form for posting to a thread."""
# Redirect to the thread
# XXX probably to the post instead; anchor? depends on paging scheme
h.flash('Your uniqueness has been added to our own.')
- redirect_to(controller='forum', action='posts',
- forum_id=forum_id, thread_id=thread_id,
- _code=303)
+ redirect(
+ url(controller='forum', action='posts',
+ forum_id=forum_id, thread_id=thread_id),
+ code=303,
+ )