# HG changeset patch # User Dirk Olmes # Date 1297833520 -3600 # Node ID 25fef7c29c5b988738601b099021d5258bbfaaa3 # Parent b2a51c24f209ea1bf37cdb0052ec3306be2d5696 remove all feed entries when removing a feed diff -r b2a51c24f209 -r 25fef7c29c5b Mapping.py --- a/Mapping.py Tue Feb 15 03:40:26 2011 +0100 +++ b/Mapping.py Wed Feb 16 06:18:40 2011 +0100 @@ -28,7 +28,7 @@ def _createMapping(engine): metadata = MetaData(engine) metadata.bind = engine - + feedTable = Table("feed", metadata, Column("pk", Integer, primary_key=True), Column("title", String(255), nullable=False), @@ -36,14 +36,14 @@ # update interval is specified in minutes Column("update_interval", Integer, nullable=False), Column("next_update", DateTime, nullable=False), - # when displaying an entry of this feed, do not display the summary but rather load + # when displaying an entry of this feed, do not display the summary but rather load # the link directly Column("auto_load_entry_link", Boolean, nullable=False), # this is actually a hack: when opening some sites in the QWebView it just crashes. # This setting forces to open an entry's link in the external browser Column("always_open_in_browser", Boolean, nullable=False) ) - + global feedEntryTable feedEntryTable = Table("feed_entry", metadata, Column("pk", Integer, primary_key=True), @@ -57,7 +57,7 @@ Column("updated", DateTime), Column("feed_id", Integer, ForeignKey("feed.pk")) ) - + preferencesTable = Table("preference", metadata, Column("pk", Integer, primary_key=True), Column("key", String(255), nullable=False), @@ -69,7 +69,7 @@ mapper(FeedEntry, feedEntryTable) mapper(Feed, feedTable, properties = { - "entries" : relation(FeedEntry, backref="feed", lazy=True) + "entries" : relation(FeedEntry, backref="feed", lazy=True, cascade="delete, delete-orphan") } ) mapper(Preference, preferencesTable)