Mercurial > hg > Feedworm
diff Mapping.py @ 102:25fef7c29c5b
remove all feed entries when removing a feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 16 Feb 2011 06:18:40 +0100 |
parents | d11c3f71ac40 |
children |
line wrap: on
line diff
--- 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)