Commits

Benoit Boissinot committed beb0c9a

fix updating

Comments (0)

Files changed (1)

         now = datetime.now()
         today = now.date()
         last_update = LastUpdate.get_or_insert("fetch", timestamp=now)
-        last = FeedArticle.all().fetch(1)
+        last = FeedArticle.all().order('-timestamp').fetch(1)
         if not last:
             for i in range(defaultfeed):
                 try:
                 newarticle(today)
             except Exception, err:
                 logging.info("Failed to fetch %s" % err)
-            self.last_update.timestamp = now
-            self.last_update.put()
+            last_update.timestamp = now
+            last_update.put()
+        self.response.out.write("OK\r\n")
 
 application = webapp.WSGIApplication(
                                      [('/update-jorf', UpdateHandler)],