diff options
author | Matt Singleton <msingleton@aclu.org> | 2017-04-23 05:33:23 -0400 |
---|---|---|
committer | Matt Singleton <msingleton@aclu.org> | 2017-04-23 05:33:23 -0400 |
commit | 1c825c79a17f9ba1e7c81668921c87ccecd672d3 (patch) | |
tree | 0e28206f61c71c54313341e2cbaf7618561561c2 | |
parent | 53ccd0a1b21963021f2281c5df1a557f95514225 (diff) |
tweak the rendering
-rw-r--r-- | unbiased/html_template/unbiased.jinja.html | 12 | ||||
-rw-r--r-- | unbiased/unbiasedFunctions.py | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/unbiased/html_template/unbiased.jinja.html b/unbiased/html_template/unbiased.jinja.html index fcca97f..4a07d0b 100644 --- a/unbiased/html_template/unbiased.jinja.html +++ b/unbiased/html_template/unbiased.jinja.html @@ -24,10 +24,10 @@ <div class="top-story"> <a target="_blank" onclick="window.open('{{ story.url }}', '_blank')"> - <div class="top-stories-img" style="background-image: url('{{ story.img }}');" /></div> - <div class="top-stories-hed">{{ story.title|safe }}</div> + <div class="top-stories-img" style="background-image: url('{{ story.img }}?{{ utime }}');" /></div> + <div class="top-stories-hed">{{ story.title }}</div> </a> - <div class="top-stories-desc">{{ story.description|safe|truncate(140) }}</div> + <div class="top-stories-desc">{{ story.description }}</div> </div> {% endfor %} @@ -45,8 +45,8 @@ <div class="middle-story"> <a target="_blank" onclick="window.open('{{ story.url }}', '_blank')"> <p> - <div class="middle-stories-img" style="background-image: url('{{ story.img }}');"></div> - {{ story.title|safe }} + <div class="middle-stories-img" style="background-image: url('{{ story.img }}?{{ utime }}');"></div> + {{ story.title }} </p> </a> </div> @@ -62,7 +62,7 @@ {% for story in bottom_stories %} <div class="bottom-story"> - <a target="_blank" onclick="window.open('{{ story.url }}', '_blank')">{{ story.title|safe }}</a> + <a target="_blank" onclick="window.open('{{ story.url }}', '_blank')">{{ story.title }}</a> </div> {% endfor %} diff --git a/unbiased/unbiasedFunctions.py b/unbiased/unbiasedFunctions.py index 46dae19..cb13a44 100644 --- a/unbiased/unbiasedFunctions.py +++ b/unbiased/unbiasedFunctions.py @@ -131,7 +131,7 @@ def buildArticle(url, sourceName, encoding=None):#, titleDelStart, titleDelEnd, logger.debug(description)
- a=Article(title, url, img, description, sourceName, author)
+ a=Article(html.unescape(title), url, img, html.unescape(description), sourceName, html.unescape(author))
return a
except Exception:
@@ -209,12 +209,14 @@ def buildOutput(top_stories, middle_stories, bottom_stories): )
template = env.get_template('unbiased.jinja.html')
- timestamp=time.strftime("%a, %b %-d, %-I:%M%P %Z", time.localtime())
+ timestamp = time.strftime("%a, %b %-d, %-I:%M%P %Z", time.localtime())
+ utime = int(time.time())
sourcesStr = ', '.join(set([x.source for x in top_stories] + [x.source for x in middle_stories] + [x.source for x in bottom_stories]))
html = template.render(
timestamp = timestamp,
+ utime = utime,
top_stories = top_stories,
middle_stories = middle_stories,
bottom_stories = bottom_stories,
|