minor change in db-structure, made mailtext column selectable

This commit is contained in:
2013-04-03 00:06:06 +02:00
parent d1d127744c
commit d60783b6aa
3 changed files with 28 additions and 19 deletions

View File

@ -57,3 +57,15 @@ class Entry(Base):
pp.pprint(entry.get('enclosures'))
#self.enclosures = entry.get('enclosures')
self.lastfetched = datetime.now()
def get_text(self):
if self.feed.contentcolumn == 'summary':
text = self.summary
elif self.feed.contentcolumn == 'content':
text = self.content
elif self.feed.contentcolumn == 'fullpage':
text = self.fullpage
elif self.feed.contentcolumn == 'readability':
text = self.readability
return text

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
#coding: utf-8
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy import Column, Integer, String, Boolean, Enum
from models import Base
@ -15,16 +15,17 @@ class Feed(Base):
resolveredirects = Column(Boolean)
readability = Column(Boolean)
fullpage = Column(Boolean)
html2textsummary = Column(Boolean)
contentcolumn = Column(Enum('summary', 'content', 'fullpage', 'readability'))
html2textcontent = Column(Boolean)
html2textignoreimages = Column(Boolean)
enabled = Column(Boolean)
def __init__(self, url, daily, readability, fullpage, enabled, html2textsummary):
def __init__(self, url, daily, readability, fullpage, enabled, html2textcontent):
self.url = url
self.daily = daily
self.readability = readability
self.fullpage = fullpage
self.html2textsummary = html2textsummary
self.html2textcontent = html2textcontent
self.enabled = enabled
def __repr__(self):