6914409bfa9720929ef2b9d5ca55420b9915e32f
[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
8 import splinext.forum.controllers.forum
9
10 def add_routes_hook(map, *args, **kwargs):
11 """Hook to inject some of our behavior into the routes configuration."""
12 require_POST = dict(conditions=dict(method=['POST']))
13
14 map.connect('/forums', controller='forum', action='forums')
15 map.connect('/forums/{forum_id}', controller='forum', action='threads')
16 map.connect('/forums/{forum_id}/threads/{thread_id}', controller='forum', action='posts')
17
18 map.connect('/forums/{forum_id}/threads/{thread_id}/write', controller='forum', action='write')
19
20
21 class ForumPlugin(PluginBase):
22 def controllers(self):
23 return dict(
24 forum = splinext.forum.controllers.forum.ForumController,
25 )
26
27 def hooks(self):
28 return [
29 ('routes_mapping', Priority.NORMAL, add_routes_hook),
30 ]