from spline.lib.plugin import PluginBase
from spline.lib.plugin import PluginBase, PluginLink, Priority
-import spline.model as model
-import spline.model.meta as meta
import splinext.forum.controllers.forum
-import splinext.forum.model
def add_routes_hook(map, *args, **kwargs):
"""Hook to inject some of our behavior into the routes configuration."""
forum = splinext.forum.controllers.forum.ForumController,
)
- def model(self):
- return [
- model.Forum,
- model.Thread,
- model.Post,
- ]
-
- def template_dirs(self):
- return [
- (resource_filename(__name__, 'templates'), Priority.NORMAL)
- ]
-
def hooks(self):
return [
('routes_mapping', Priority.NORMAL, add_routes_hook),
from routes import request_config
from sqlalchemy.orm.exc import NoResultFound
-from spline import model
from spline.model import meta
from spline.lib import helpers as h
from spline.lib.base import BaseController, render
+from splinext.forum import model as forum_model
log = logging.getLogger(__name__)
class ForumController(BaseController):
def forums(self):
- c.forums = meta.Session.query(model.Forum).order_by(model.Forum.id.asc())
+ c.forums = meta.Session.query(forum_model.Forum) \
+ .order_by(forum_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)
+ c.forum = meta.Session.query(forum_model.Forum).get(forum_id)
except NoResultFound:
abort(404)
def posts(self, forum_id, thread_id):
try:
- c.thread = meta.Session.query(model.Thread) \
+ c.thread = meta.Session.query(forum_model.Thread) \
.filter_by(id=thread_id, forum_id=forum_id).one()
except NoResultFound:
abort(404)