Mercurial > hg > Feedworm
comparison backend/sqlalchemy/SqlAlchemyBackend.py @ 168:f4708d38419c
move methods around so the SqlAlchemyBackend only needs to import the class
author | dirk |
---|---|
date | Mon, 05 Sep 2011 19:43:34 +0200 |
parents | a3c945ce434c |
children | 3bcf39181f6e |
comparison
equal
deleted
inserted
replaced
167:a3c945ce434c | 168:f4708d38419c |
---|---|
1 | 1 |
2 from Feed import Feed | 2 from Feed import Feed |
3 from FeedEntry import FeedEntry | 3 from FeedEntry import FeedEntry |
4 from FeedUpdater import FeedUpdater | |
4 from Preferences import Preferences | 5 from Preferences import Preferences |
5 from backend.AbstractBackend import AbstractBackend | 6 from backend.AbstractBackend import AbstractBackend |
6 from datetime import datetime, timedelta | 7 from datetime import datetime, timedelta |
7 from sqlalchemy.orm import joinedload | 8 from sqlalchemy.orm import joinedload |
8 from sqlalchemy.sql import and_ | 9 from sqlalchemy.sql import and_ |
9 import Database | 10 import Database |
10 import FeedUpdater | |
11 import Mapping | 11 import Mapping |
12 import logging | 12 import logging |
13 import util | 13 import util |
14 | 14 |
15 class SqlAlchemyBackend(AbstractBackend): | 15 class SqlAlchemyBackend(AbstractBackend): |
76 def createFeed(self, url): | 76 def createFeed(self, url): |
77 try: | 77 try: |
78 newFeed = Feed(url) | 78 newFeed = Feed(url) |
79 self.session.add(newFeed) | 79 self.session.add(newFeed) |
80 | 80 |
81 FeedUpdater.FeedUpdater(self.preferences(), self.session).update(newFeed) | 81 FeedUpdater(self.preferences(), self.session).update(newFeed) |
82 self.session.commit() | 82 self.session.commit() |
83 except AttributeError as ae: | 83 except AttributeError as ae: |
84 self.session.rollback() | 84 self.session.rollback() |
85 raise ae | 85 raise ae |
86 | 86 |