From 66690cfe484256d387bde855aba20963f6900de4 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 21 Nov 2012 13:39:23 +0100 Subject: Created new branch "Mako integration". First test of Mako with the plain_text page. --- source/pyAggr3g470r.py | 21 ++++++++++----------- source/templates/plain_text.html | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 source/templates/plain_text.html (limited to 'source') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 9a16d437..de436ff4 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -43,6 +43,10 @@ import re import cherrypy import calendar +from mako.template import Template +from mako.lookup import TemplateLookup +lookup = TemplateLookup(directories=['templates']) + from collections import Counter import datetime @@ -947,18 +951,13 @@ class pyAggr3g470r(object): article = self.mongo.get_article(feed_id, article_id) except: return self.error_page("Bad URL. This article do not exists.") - html = htmlheader() - html += htmlnav - html += """
""" - html += """

%s from %s

\n
\n"""% \ - (article["article_title"], feed_id, feed["feed_title"]) description = utils.clear_string(article["article_content"]) - if description: - html += description - else: - html += "No description available." - html += "\n
\n" + htmlfooter - return html + if not description: + description += "Unvailable" + tmpl = lookup.get_template("plain_text.html") + return tmpl.render(feed_title=feed["feed_title"], \ + article_title=article["article_title"], \ + description = description) plain_text.exposed = True diff --git a/source/templates/plain_text.html b/source/templates/plain_text.html new file mode 100644 index 00000000..8bd606de --- /dev/null +++ b/source/templates/plain_text.html @@ -0,0 +1,19 @@ + + + + pyAggr3g470r - News aggregator + + + + + +
+

${article_title} from ${feed_title}


+ ${description} +
+

This software is under GPLv3 license. You are welcome to copy, modify or + redistribute the source code according to the + GPLv3 license.

+
+ + -- cgit