55ffaa280cfd9b6111170e0c41888efa2b1ece84
[zzz-spline-forum.git] / splinext / forum / __init__.py
1 from pkg_resources import resource_filename
2
3 from pylons import c, session
4
5 from spline.lib.plugin import PluginBase
6 from spline.lib.plugin import PluginBase, PluginLink, Priority
7 import spline.model as model
8 import spline.model.meta as meta
9
10 import splinext.forum.controllers.forum
11 import splinext.forum.model
12
13 def add_routes_hook(map, *args, **kwargs):
14 """Hook to inject some of our behavior into the routes configuration."""
15 map.connect('/forums', controller='forum', action='forums')
16 map.connect('/forums/{forum_id}', controller='forum', action='threads')
17 map.connect('/forums/{forum_id}/threads/{thread_id}', controller='forum', action='posts')
18
19
20 class ForumPlugin(PluginBase):
21 def controllers(self):
22 return dict(
23 forum = splinext.forum.controllers.forum.ForumController,
24 )
25
26 def model(self):
27 return [
28 model.Forum,
29 model.Thread,
30 model.Post,
31 ]
32
33 def template_dirs(self):
34 return [
35 (resource_filename(__name__, 'templates'), Priority.NORMAL)
36 ]
37
38 def hooks(self):
39 return [
40 ('routes_mapping', Priority.NORMAL, add_routes_hook),
41 ]