Tidied up presentation: correct ordering, CSS, and no more debug junk.
[zzz-spline-frontpage.git] / splinext / frontpage / controllers / frontpage.py
1 import logging
2
3 from pylons import config, request, response, session, tmpl_context as c, url
4 from pylons.controllers.util import abort, redirect_to
5 from routes import request_config
6 from sqlalchemy.orm.exc import NoResultFound
7
8 from spline.lib import helpers as h
9 from spline.lib.base import BaseController, render
10 from spline.lib.plugin.load import run_hooks
11
12 log = logging.getLogger(__name__)
13
14 class FrontPageController(BaseController):
15
16 def index(self):
17 """Magicaltastic front page.
18
19 Plugins can register things to appear on it, somehow.
20
21 Local plugins can override the fairly simple index.mako template to
22 customize the front page layout.
23 """
24 # Hooks should return a list of FrontPageUpdate objects, making this
25 # return value a list of lists
26 updates_lol = run_hooks('frontpage_updates', limit=10)
27 updates = sum(updates_lol, [])
28
29 updates.sort(key=lambda obj: obj.time)
30 updates.reverse()
31 c.updates = updates[0:10]
32
33 return render('/index.mako')