def add_routes_hook(map, *args, **kwargs):
"""Hook to inject some of our behavior into the routes configuration."""
+ require_POST = dict(conditions=dict(method=['POST']))
+
map.connect('/forums', controller='forum', action='forums')
map.connect('/forums/{forum_id}', controller='forum', action='threads')
map.connect('/forums/{forum_id}/threads/{thread_id}', controller='forum', action='posts')
+ map.connect('/forums/{forum_id}/write', controller='forum', action='write_thread')
+ map.connect('/forums/{forum_id}/threads/{thread_id}/write', controller='forum', action='write')
+
class ForumPlugin(PluginBase):
def controllers(self):
)
def hooks(self):
- return [
+ hooks = [
('routes_mapping', Priority.NORMAL, add_routes_hook),
]
+
+ # frontpage plugin may or may not be installed
+ try:
+ from splinext.forum.frontpage_sources import ForumSource
+ hooks.append(
+ ('frontpage_updates_forum', Priority.NORMAL, ForumSource))
+ except ImportError:
+ pass
+
+ return hooks