diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-21 13:39:23 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-21 13:39:23 +0100 |
commit | 66690cfe484256d387bde855aba20963f6900de4 (patch) | |
tree | c81e7ce187b188dda9e49c6db00ff82c34f74264 /source/pyAggr3g470r.py | |
parent | Name of the currently consulted article is displayed on the tab. (diff) | |
download | newspipe-66690cfe484256d387bde855aba20963f6900de4.tar.gz newspipe-66690cfe484256d387bde855aba20963f6900de4.tar.bz2 newspipe-66690cfe484256d387bde855aba20963f6900de4.zip |
Created new branch "Mako integration". First test of Mako with the plain_text page.
Diffstat (limited to 'source/pyAggr3g470r.py')
-rwxr-xr-x | source/pyAggr3g470r.py | 21 |
1 files changed, 10 insertions, 11 deletions
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 += """<div class="left inner">""" - html += """<h1><i>%s</i> from <a href="/articles/%s">%s</a></h1>\n<br />\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<hr />\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 |