Cap blog entries at todays date
authorMagnus Hagander <magnus@hagander.net>
Tue, 29 Mar 2016 08:41:12 +0000 (10:41 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 29 Mar 2016 08:41:12 +0000 (10:41 +0200)
This avoids cases where a blog entry might be unintentionally (or intentionally)
set with a date in the future in the incoming RSS feed and as such stays at the
frontpage of planet until that date is reached.

Instead, whenever something is parsed to be in the future, set the post date to
the time of the parsing (because it clearly exists at this time).

hamnadmin/hamnadmin/util/aggregate.py

index 6a3c9ce08381b6407db5ea789418c86e9a89d395..2a77d41e521b9065faf9c4da37122339ce8fc57b 100644 (file)
@@ -79,6 +79,9 @@ class FeedFetcher(object):
                                self._trace("Failed to get date for entry %s (keys %s)" % (entry.link, entry.keys()))
                                continue
 
+                       if dat > datetime.datetime.now():
+                               dat = datetime.datetime.now()
+
                        if self.newest_entry_date:
                                if dat > self.newest_entry_date:
                                        self.newest_entry_date = dat