From 16a2995a38feb21c3477a474a752efd9005e6b4f Mon Sep 17 00:00:00 2001 From: Eevee Date: Sun, 25 Jul 2010 22:18:17 -0700 Subject: [PATCH] Split off updates to another template. List sources. --- splinext/frontpage/controllers/frontpage.py | 3 ++- splinext/frontpage/templates/front_page/updates.mako | 13 +++++++++++++ splinext/frontpage/templates/index.mako | 6 ++---- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 splinext/frontpage/templates/front_page/updates.mako diff --git a/splinext/frontpage/controllers/frontpage.py b/splinext/frontpage/controllers/frontpage.py index 764b292..0990e81 100644 --- a/splinext/frontpage/controllers/frontpage.py +++ b/splinext/frontpage/controllers/frontpage.py @@ -52,7 +52,8 @@ class FrontPageController(BaseController): global_max_age = max_age_to_datetime( config['spline-frontpage.max_age']) - for source in config['spline-frontpage.sources']: + c.sources = config['spline-frontpage.sources'] + for source in c.sources: new_updates = source.poll(global_limit, global_max_age) updates.extend(new_updates) diff --git a/splinext/frontpage/templates/front_page/updates.mako b/splinext/frontpage/templates/front_page/updates.mako new file mode 100644 index 0000000..9a6f584 --- /dev/null +++ b/splinext/frontpage/templates/front_page/updates.mako @@ -0,0 +1,13 @@ +% for update in c.updates: +<%include file="${update.source.template}" args="update=update" /> +% endfor +% if not c.updates: +

No updates.

+% endif + +

Sources:

+ diff --git a/splinext/frontpage/templates/index.mako b/splinext/frontpage/templates/index.mako index 677c58c..b7a3b5c 100644 --- a/splinext/frontpage/templates/index.mako +++ b/splinext/frontpage/templates/index.mako @@ -1,8 +1,6 @@ <%inherit file="base.mako" /> -<%def name="title()">Home +<%def name="title()">Updates

Updates

-% for update in c.updates: -<%include file="${update.source.template}" args="update=update" /> -% endfor +<%include file="/front_page/updates.mako" /> -- 2.7.4