--- /dev/null
+*.swp
+*.pyc
+
+*.egg-info/
--- /dev/null
+from setuptools import setup, find_packages
+setup(
+ name = 'spline-frontpage',
+ version = '0.1',
+ packages = find_packages(),
+
+ install_requires = [
+ 'spline',
+ ],
+
+ include_package_data = True,
+
+ zip_safe = False,
+
+ entry_points = {'spline.plugins': 'frontpage = splinext.frontpage:FrontPagePlugin'},
+
+ namespace_packages = ['splinext'],
+)
--- /dev/null
+__import__('pkg_resources').declare_namespace(__name__)
--- /dev/null
+from pkg_resources import resource_filename
+
+from spline.lib.plugin import PluginBase
+from spline.lib.plugin import PluginBase, PluginLink, Priority
+
+import splinext.frontpage.controllers.frontpage
+
+def add_routes_hook(map, *args, **kwargs):
+ """Hook to inject some of our behavior into the routes configuration."""
+ map.connect('/', controller='frontpage', action='index')
+
+
+class FrontPagePlugin(PluginBase):
+ def controllers(self):
+ return dict(
+ frontpage = splinext.frontpage.controllers.frontpage.FrontPageController,
+ )
+
+ def template_dirs(self):
+ return [
+ (resource_filename(__name__, 'templates'), Priority.FIRST)
+ ]
+
+ def hooks(self):
+ return [
+ ('routes_mapping', Priority.NORMAL, add_routes_hook),
+ ]
--- /dev/null
+import logging
+
+from pylons import config, request, response, session, tmpl_context as c, url
+from pylons.controllers.util import abort, redirect_to
+from routes import request_config
+from sqlalchemy.orm.exc import NoResultFound
+
+from spline.lib import helpers as h
+from spline.lib.base import BaseController, render
+from spline.lib.plugin.load import run_hooks
+
+log = logging.getLogger(__name__)
+
+class FrontPageController(BaseController):
+
+ def index(self):
+ """Magicaltastic front page.
+
+ Plugins can register things to appear on it, somehow.
+
+ Local plugins can override the fairly simple index.mako template to
+ customize the front page layout.
+ """
+ # Hooks should return a list of FrontPageUpdate objects, making this
+ # return value a list of lists
+ updates_lol = run_hooks('frontpage_updates', limit=10)
+ updates = sum(updates_lol, [])
+ updates.sort(key=lambda obj: obj.time)
+
+ c.updates = updates[0:10]
+
+ return render('/index.mako')
--- /dev/null
+<%inherit file="base.mako" />
+
+<%def name="title()">Home</%def>
+
+<h1>Updates</h1>
+% for update in c.updates:
+<p>${repr(update.__dict__)}</p>
+<%include file="${update.template}" args="update=update" />
+<hr>
+% endfor