Mercurial > hg > Feedworm
diff backend/couchdb/FeedUpdater.py @ 147:b290e29a94b5
use couchdb's mapping API instead of manually coding around Rows - much leaner code :-)
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 25 Aug 2011 11:05:05 +0200 |
parents | 74217db92993 |
children | 2940e74c9663 |
line wrap: on
line diff
--- a/backend/couchdb/FeedUpdater.py Thu Aug 25 07:01:45 2011 +0200 +++ b/backend/couchdb/FeedUpdater.py Thu Aug 25 11:05:05 2011 +0200 @@ -1,8 +1,6 @@ from FeedEntry import FeedEntry from backend.AbstractFeedUpdater import AbstractFeedUpdater -from datetime import datetime -import Feed import logging log = logging.getLogger("FeedUpdater") @@ -19,13 +17,14 @@ def _createFeedEntry(self, entry): log.info("new feed entry: " + entry.title) - feedEntry = { "type" : "feedEntry", "feed" : self.feed._id, "link" : entry.link, - "title" : entry.title, "summary" : entry.summary, "read" : False, - "updated" : entry.updated} - self.database.save(feedEntry) + feedEntry = FeedEntry() + feedEntry.feed = self.feed.id + feedEntry.link = entry.link + feedEntry.title = entry.title + feedEntry.summary = entry.summary + feedEntry.updated = entry.updated_parsed + feedEntry.store(self.database) def _incrementFeedUpdateDate(self): - updateDate = self.feed.incrementedUpdateDate() - document = self.database.get(self.feed._id) - document["next_update"] = datetime.strftime(updateDate, Feed.DATE_FORMAT) - self.database.save(document) + self.feed.incrementNextUpdateDate() + self.feed.store(self.database)