ea80f05030fee790438e00e7c73f064a71ef1613
[zzz-spline-frontpage.git] / splinext / frontpage / __init__.py
1 from collections import namedtuple
2 import datetime
3 from pkg_resources import resource_filename
4 import subprocess
5
6 from spline.lib import helpers
7 from spline.lib.plugin import PluginBase, PluginLink, Priority
8
9 import splinext.frontpage.controllers.frontpage
10 from splinext.frontpage.sources import FeedSource, GitSource
11
12 def add_routes_hook(map, *args, **kwargs):
13 """Hook to inject some of our behavior into the routes configuration."""
14 map.connect('/', controller='frontpage', action='index')
15
16
17 class FrontPagePlugin(PluginBase):
18 def controllers(self):
19 return dict(
20 frontpage = splinext.frontpage.controllers.frontpage.FrontPageController,
21 )
22
23 def template_dirs(self):
24 return [
25 (resource_filename(__name__, 'templates'), Priority.FIRST)
26 ]
27
28 def hooks(self):
29 return [
30 ('routes_mapping', Priority.NORMAL, add_routes_hook),
31 ('frontpage_updates_rss', Priority.NORMAL, FeedSource),
32 ('frontpage_updates_git', Priority.NORMAL, GitSource),
33 ]