diff backend/sqlalchemy/SqlAlchemyBackend.py @ 123:862760b161b4 backend

restructured adding a feed so that only the URL is passed into the backend - the rest of the operation is backend-internal
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 22 Aug 2011 10:30:33 +0200
parents f5afe0c1f4d2
children a4b2077c9603
line wrap: on
line diff
--- a/backend/sqlalchemy/SqlAlchemyBackend.py	Sun Aug 21 18:39:02 2011 +0200
+++ b/backend/sqlalchemy/SqlAlchemyBackend.py	Mon Aug 22 10:30:33 2011 +0200
@@ -1,10 +1,10 @@
 
 from Preferences import Preferences
-from FeedUpdater import FeedUpdater
 import Database
+import FeedList
+import FeedUpdater
 import logging
 import util
-import FeedList
 
 class SqlAlchemyBackend(object):
     '''
@@ -28,11 +28,6 @@
     def preferences(self):
         return self.prefs
 
-    def feedUpdater(self):
-        if self.updater is None:
-            self.updater = FeedUpdater(self.session)
-        return self.updater
-
     def getFeeds(self):
         return FeedList.getFeeds(self.session)
 
@@ -44,6 +39,14 @@
         feed.markAllEntriesRead()
         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 dispose(self):
         # save all uncommitted state, just in case
         self.session.commit()