fixed problem with empty entries

This commit is contained in:
Ronald Schaten 2013-04-08 22:47:22 +02:00
parent 777b8de0e3
commit 9cca4d292a

View File

@ -95,13 +95,13 @@ class Entry(Base):
h2t.inline_links = False h2t.inline_links = False
if feed.html2textignoreimages: if feed.html2textignoreimages:
h2t.ignore_images = True h2t.ignore_images = True
if feed.contentcolumn == 'summary': if feed.contentcolumn == 'summary' and self.summary:
self.summary = h2t.handle(self.summary) self.summary = h2t.handle(self.summary)
elif feed.contentcolumn == 'content': elif feed.contentcolumn == 'content' and self.content:
self.content = h2t.handle(self.content) self.content = h2t.handle(self.content)
elif feed.contentcolumn == 'fullpage': elif feed.contentcolumn == 'fullpage' and self.fullpage:
self.fullpage = h2t.handle(self.fullpage) self.fullpage = h2t.handle(self.fullpage)
elif feed.contentcolumn == 'readability': elif feed.contentcolumn == 'readability' and self.readability:
self.readability = h2t.handle(self.readability) self.readability = h2t.handle(self.readability)
hp = HTMLParser.HTMLParser() hp = HTMLParser.HTMLParser()
if self.summary: if self.summary:
@ -125,13 +125,14 @@ class Entry(Base):
return "<Entry('%d','%s')>" % (self.id, self.title) return "<Entry('%d','%s')>" % (self.id, self.title)
def get_text(self): def get_text(self):
if self.feed.contentcolumn == 'summary': text = ''
if self.feed.contentcolumn == 'summary' and self.summary:
text = self.summary text = self.summary
elif self.feed.contentcolumn == 'content': elif self.feed.contentcolumn == 'content' and self.content:
text = self.content text = self.content
elif self.feed.contentcolumn == 'fullpage': elif self.feed.contentcolumn == 'fullpage' and self.fullpage:
text = self.fullpage text = self.fullpage
elif self.feed.contentcolumn == 'readability': elif self.feed.contentcolumn == 'readability' and self.readability:
text = self.readability text = self.readability
if self.enclosures: if self.enclosures:
text += '\n\nEnclosures:\n%s' % self.enclosures text += '\n\nEnclosures:\n%s' % self.enclosures