From 31788558cfad8e6c74381bc9ed9b7530c9636c25 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 14 Oct 2013 22:44:07 +0200 Subject: Still trying to sort those f* articles. --- pyaggr3g470r/feedgetter.py | 3 ++- pyaggr3g470r/log.py | 2 +- pyaggr3g470r/templates/articles.html | 6 ++++++ pyaggr3g470r/views.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyaggr3g470r/feedgetter.py b/pyaggr3g470r/feedgetter.py index 491d110c..be942a2c 100644 --- a/pyaggr3g470r/feedgetter.py +++ b/pyaggr3g470r/feedgetter.py @@ -102,6 +102,7 @@ class FeedGetter(object): exist = models.Article.objects(link=article.link).first() if exist != None: + print "Already in database" continue description = "" @@ -148,7 +149,7 @@ class FeedGetter(object): article_title, description)).start() """ feed.articles.extend(articles) - feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=True) + feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=False) feed.save() diff --git a/pyaggr3g470r/log.py b/pyaggr3g470r/log.py index 5db5d838..9c86be74 100755 --- a/pyaggr3g470r/log.py +++ b/pyaggr3g470r/log.py @@ -36,7 +36,7 @@ class Log(object): """ import logging self.logger = logging.getLogger("pyaggr3g470r") - hdlr = logging.FileHandler('./var/pyaggr3g470r.log') + hdlr = logging.FileHandler('./pyaggr3g470r/var/pyaggr3g470r.log') formater = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formater) self.logger.addHandler(hdlr) diff --git a/pyaggr3g470r/templates/articles.html b/pyaggr3g470r/templates/articles.html index c0abccdf..20dd0e7f 100644 --- a/pyaggr3g470r/templates/articles.html +++ b/pyaggr3g470r/templates/articles.html @@ -21,6 +21,12 @@ {% if feed.articles[feed.articles|length-1].readed %}{% else %}{% endif %}
{{ feed.articles[feed.articles|length-1].date }}
+
+ {% if feed.articles[feed.articles|length-2].readed %}

{% else %}

{% endif %} + {{ feed.articles[feed.articles|length-2].title }}

+ {% if feed.articles[feed.articles|length-2].readed %}

{% else %}{% endif %} +
{{ feed.articles[feed.articles|length-2].date }}
+
{% endif %} diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index fa67393a..3736210a 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -59,7 +59,7 @@ def delete(article_id=None): @app.route('/articles/', methods=['GET']) def articles(feed_id=None): feed = models.Feed.objects(id=feed_id).first() - #feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=True) + #feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=False) #feed.save() return render_template('articles.html', feed=feed) -- cgit