comparison FeedUpdater.py @ 5:bfd47f55d85b

add the updated date of the feed
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 26 Apr 2010 20:46:37 +0200
parents e0199f383442
children 215c34f61e95
comparison
equal deleted inserted replaced
4:e0199f383442 5:bfd47f55d85b
1 1
2 from datetime import datetime
2 from Feed import Feed 3 from Feed import Feed
3 from FeedEntry import FeedEntry 4 from FeedEntry import FeedEntry
4 import feedparser 5 import feedparser
5 6
6 def updateAllFeeds(session): 7 def updateAllFeeds(session):
23 feedEntry = FeedEntry.findById(entry.id, self.session) 24 feedEntry = FeedEntry.findById(entry.id, self.session)
24 if feedEntry is None: 25 if feedEntry is None:
25 self.createFeedEntry(entry) 26 self.createFeedEntry(entry)
26 27
27 def createFeedEntry(self, entry): 28 def createFeedEntry(self, entry):
28 newEntry = FeedEntry(id=entry.id, url=entry.link, title=entry.title, summary=entry.summary) 29 new = FeedEntry()
29 newEntry.feed = self.feed 30 new.id = entry.id
30 self.session.add(newEntry) 31 new.link = entry.link
32 new.title = entry.title
33 new.updated = datetime(*entry.updated_parsed[:6])
34 new.summary = entry.summary
35 new.feed = self.feed
36 self.session.add(new)