Rework currentonly code to update articles rather than adding them each
authorAdam Sampson <ats@offog.org>
Sun, 16 Jan 2005 21:05:34 +0000 (21:05 +0000)
committerAdam Sampson <ats@offog.org>
Sun, 16 Jan 2005 21:05:34 +0000 (21:05 +0000)
time.

NEWS
rawdoglib/rawdog.py

diff --git a/NEWS b/NEWS
index a9092338ce4be496c667b9900292db2147d5f751..38facd1791e6f0beff918d79ecf002feafa587cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@
 
 Provide guid in item templates (suggested by Rick van Rein).
 
+Update article-added dates correctly when "currentonly true" is used
+(reported by Rick van Rein).
+
 - rawdog 2.3
 
 Make the id= parameter work correctly (patch from Jon Nelson).
index d6c14319f274bc1daf875c6d1e6a00c13c9d2f7f..00c19fc3c9e58033f29e8a6f81afb7acc9f1f9f4 100644 (file)
@@ -341,11 +341,7 @@ class Feed:
                self.feed_info = p["feed"]
                feed = self.url
 
-               if config["currentonly"]:
-                       for (hash, a) in articles.items():
-                               if a.feed == feed:
-                                       del articles[hash]
-
+               seen = {}
                sequence = 0
                for entry_info in p["entries"]:
                        article = Article(feed, entry_info, now, sequence)
@@ -353,6 +349,7 @@ class Feed:
                        plugins.call_hook("article_seen", rawdog, config, article, ignore)
                        if ignore.value:
                                continue
+                       seen[article.hash] = True
                        sequence += 1
 
                        if articles.has_key(article.hash):
@@ -362,6 +359,11 @@ class Feed:
                                articles[article.hash] = article
                                plugins.call_hook("article_added", rawdog, config, article, now)
 
+               if config["currentonly"]:
+                       for (hash, a) in articles.items():
+                               if a.feed == feed and not seen.has_key(hash):
+                                       del articles[hash]
+
                return True
 
        def get_html_name(self, config):