From: Eevee Date: Mon, 17 May 2010 02:27:01 +0000 (-0700) Subject: Use the local model module instead of spline.model. X-Git-Tag: veekun-promotions/2010060201~4 X-Git-Url: http://git.veekun.com/zzz-spline-forum.git/commitdiff_plain/e50129eabfd1aeb25bcfce911546699b89b0019c Use the local model module instead of spline.model. --- diff --git a/splinext/forum/__init__.py b/splinext/forum/__init__.py index 55ffaa2..98ad4af 100644 --- a/splinext/forum/__init__.py +++ b/splinext/forum/__init__.py @@ -4,11 +4,8 @@ from pylons import c, session 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.""" @@ -23,18 +20,6 @@ class ForumPlugin(PluginBase): 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), diff --git a/splinext/forum/controllers/forum.py b/splinext/forum/controllers/forum.py index bf66618..77e3fe4 100644 --- a/splinext/forum/controllers/forum.py +++ b/splinext/forum/controllers/forum.py @@ -5,22 +5,23 @@ from pylons.controllers.util import abort, redirect_to 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) @@ -28,7 +29,7 @@ class ForumController(BaseController): 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)