Mercurial > hg > Feedworm
diff backend/sqlalchemy/SqlAlchemyBackend.py @ 154:2682db280be0
reorder methods
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 27 Aug 2011 07:32:01 +0200 |
parents | 65c4bb6d5add |
children | a05719a6175e |
line wrap: on
line diff
--- a/backend/sqlalchemy/SqlAlchemyBackend.py Sat Aug 27 07:29:33 2011 +0200 +++ b/backend/sqlalchemy/SqlAlchemyBackend.py Sat Aug 27 07:32:01 2011 +0200 @@ -37,6 +37,11 @@ def preferences(self): return self.prefs + def dispose(self): + # save all uncommitted state, just in case + self.session.commit() + self.session.close() + # # handling of feeds # @@ -78,6 +83,23 @@ self.session.delete(self.selectedFeed) self.session.commit() + def createFeed(self, url): + try: + FeedUpdater.createNewFeed(url, self.session) + self.session.commit() + except AttributeError as ae: + self.session.rollback() + raise ae + + def updateAllFeeds(self): + FeedUpdater.updateAllFeeds(self.session) + self.session.commit() + + def updateFeed(self, feed, changes): + feed.takeChangesFrom(changes) + feed.incrementNextUpdateDate() + self.session.commit() + # # handling of the selected feed entry # @@ -96,26 +118,6 @@ self.session.commit() - - def createFeed(self, url): - try: - FeedUpdater.createNewFeed(url, self.session) - self.session.commit() - except AttributeError as ae: - self.session.rollback() - raise ae - - def updateFeed(self, feed, changes): - feed.takeChangesFrom(changes) - feed.incrementNextUpdateDate() - self.session.commit() - - - - def updateAllFeeds(self): - FeedUpdater.updateAllFeeds(self.session) - self.session.commit() - def expireFeedEntries(self): logger = logging.getLogger("feedupdater") expireDate = self._calculateExpireDate() @@ -132,8 +134,3 @@ daysToKeepFeedEntries = self.prefs.daysToKeepFeedEntries() delta = timedelta(days=daysToKeepFeedEntries) return now - delta - - def dispose(self): - # save all uncommitted state, just in case - self.session.commit() - self.session.close()