Mercurial > hg > Feedworm
comparison feedupdate-main.py @ 5:bfd47f55d85b
add the updated date of the feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 26 Apr 2010 20:46:37 +0200 |
parents | e0199f383442 |
children | 87317ba41816 |
comparison
equal
deleted
inserted
replaced
4:e0199f383442 | 5:bfd47f55d85b |
---|---|
15 parser = ConfigParser(); | 15 parser = ConfigParser(); |
16 parser.read(filename) | 16 parser.read(filename) |
17 return parser.get("database", "url") | 17 return parser.get("database", "url") |
18 | 18 |
19 def createFeed(session): | 19 def createFeed(session): |
20 newFeed = Feed("Joel on Software", "http://www.joelonsoftware.com/rss.xml") | 20 if len(session.query(Feed).all()) == 0: |
21 session.add(newFeed) | 21 newFeed = Feed("Joel on Software", "http://www.joelonsoftware.com/rss.xml") |
22 session.commit() | 22 session.add(newFeed) |
23 session.commit() | |
23 | 24 |
24 def listFeeds(session): | 25 def listFeeds(session): |
25 allFeeds = session.query(Feed) | 26 allFeeds = session.query(Feed) |
26 for feed in allFeeds: | 27 for feed in allFeeds: |
27 print "\n\nfeed: " + feed.name | 28 print "\n\nfeed: " + feed.name |
34 Mapping.createMapping(engine) | 35 Mapping.createMapping(engine) |
35 SessionMaker = sessionmaker(bind = engine) | 36 SessionMaker = sessionmaker(bind = engine) |
36 session = SessionMaker() | 37 session = SessionMaker() |
37 | 38 |
38 #createFeed(session) | 39 #createFeed(session) |
39 updateAllFeeds(session) | 40 #updateAllFeeds(session) |
40 #listFeeds(session) | 41 listFeeds(session) |