comparison backend/sqlalchemy/FeedUpdater.py @ 143:f0941f42314c

remove the normalize method, it was pulled up to the parent class
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 24 Aug 2011 11:04:09 +0200
parents 1524e1cefd39
children 74217db92993
comparison
equal deleted inserted replaced
142:1524e1cefd39 143:f0941f42314c
17 log.warn("problems while updating feed " + feed.rss_url + ": " + str(fue)) 17 log.warn("problems while updating feed " + feed.rss_url + ": " + str(fue))
18 session.commit() 18 session.commit()
19 19
20 def findFeedsToUpdate(session): 20 def findFeedsToUpdate(session):
21 return session.query(Feed).filter(Feed.next_update < datetime.now()) 21 return session.query(Feed).filter(Feed.next_update < datetime.now())
22
23 def normalize(entry):
24 if not hasattr(entry, "id"):
25 entry.id = entry.link
26 if not hasattr(entry, "updated_parsed"):
27 entry.updated_parsed = datetime.today()
28 else:
29 entry.updated_parsed = datetime(*entry.updated_parsed[:6])
30 if not hasattr(entry, "summary"):
31 if hasattr(entry, "content"):
32 entry.summary = entry.content[0].value
33 else:
34 entry.summary = ""
35 22
36 def createNewFeed(url, session): 23 def createNewFeed(url, session):
37 # when updating to python3 see http://code.google.com/p/feedparser/issues/detail?id=260 24 # when updating to python3 see http://code.google.com/p/feedparser/issues/detail?id=260
38 result = feedparser.parse(url) 25 result = feedparser.parse(url)
39 if result.has_key("title"): 26 if result.has_key("title"):