fix Newsfeed and GenericBackend
This commit is contained in:
parent
44b19e74db
commit
a0e4171af3
3 changed files with 6 additions and 7 deletions
|
|
@ -39,7 +39,6 @@ class NewspaperPresseuropBrowser(BaseBrowser):
|
||||||
|
|
||||||
def get_content(self, _id):
|
def get_content(self, _id):
|
||||||
"return page article content"
|
"return page article content"
|
||||||
print _id
|
|
||||||
self.location(_id)
|
self.location(_id)
|
||||||
return self.page.get_article(_id)
|
return self.page.get_article(_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
def iter_threads(self):
|
def iter_threads(self):
|
||||||
for article in Newsfeed(self.RSS_FEED, self.RSSID).iter_entries():
|
for article in Newsfeed(self.RSS_FEED, GenericNewspaperBackend.RSSID).iter_entries():
|
||||||
thread = Thread(article.id)
|
thread = Thread(article.id)
|
||||||
thread.title = article.title
|
thread.title = article.title
|
||||||
thread.date = article.datetime
|
thread.date = article.datetime
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,6 @@ __all__ = ['Entry', 'Newsfeed']
|
||||||
|
|
||||||
class Entry:
|
class Entry:
|
||||||
def __init__(self, entry, rssid_func=None):
|
def __init__(self, entry, rssid_func=None):
|
||||||
if rssid_func:
|
|
||||||
self.id = rssid_func(entry)
|
|
||||||
else:
|
|
||||||
self.id = entry.id
|
|
||||||
|
|
||||||
if entry.has_key("link"):
|
if entry.has_key("link"):
|
||||||
self.link = entry["link"]
|
self.link = entry["link"]
|
||||||
else:
|
else:
|
||||||
|
|
@ -68,6 +63,11 @@ class Entry:
|
||||||
elif self.summary:
|
elif self.summary:
|
||||||
self.content.append(self.summary)
|
self.content.append(self.summary)
|
||||||
|
|
||||||
|
if rssid_func:
|
||||||
|
self.id = rssid_func(self)
|
||||||
|
else:
|
||||||
|
self.id = entry.id
|
||||||
|
|
||||||
class Newsfeed:
|
class Newsfeed:
|
||||||
def __init__(self, url, rssid_func=None):
|
def __init__(self, url, rssid_func=None):
|
||||||
self.feed = feedparser.parse(url)
|
self.feed = feedparser.parse(url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue