X-Git-Url: http://git.veekun.com/zzz-spline-forum.git/blobdiff_plain/19a1e214ee68488383c2c6e51b9306a3bdf1091f..e24696628dac6692cf27fbda910f10522dae7759:/spline/plugins/forum/controllers/forum.py diff --git a/spline/plugins/forum/controllers/forum.py b/spline/plugins/forum/controllers/forum.py index 6d577fb..bf66618 100644 --- a/spline/plugins/forum/controllers/forum.py +++ b/spline/plugins/forum/controllers/forum.py @@ -14,8 +14,23 @@ log = logging.getLogger(__name__) class ForumController(BaseController): - def index(self): - # Return a rendered template - # return render('/template.mako') - # or, Return a response - return 'stub' + def forums(self): + c.forums = meta.Session.query(model.Forum).order_by(model.Forum.id.asc()) + return render('/forum/forums.mako') + + def threads(self, forum_id): + try: + c.forum = meta.Session.query(model.Forum).get(forum_id) + except NoResultFound: + abort(404) + + return render('/forum/threads.mako') + + def posts(self, forum_id, thread_id): + try: + c.thread = meta.Session.query(model.Thread) \ + .filter_by(id=thread_id, forum_id=forum_id).one() + except NoResultFound: + abort(404) + + return render('/forum/threads.mako')