feeds: make wheezy.template mandatory

Cleaner code. Less confusing.
master
pictuga 2017-03-08 15:38:59 -10:00 committed by GitHub
parent 795a0b281f
commit f4f6a86147
1 changed files with 3 additions and 9 deletions

View File

@ -15,12 +15,9 @@ import dateutil.parser
from . import crawler
try:
from wheezy.template.engine import Engine
from wheezy.template.loader import DictLoader
from wheezy.template.ext.core import CoreExtension
except ImportError:
Engine = DictLoader = CoreExtension = None
from wheezy.template.engine import Engine
from wheezy.template.loader import DictLoader
from wheezy.template.ext.core import CoreExtension
json.encoder.c_make_encoder = None
@ -389,9 +386,6 @@ class FeedParser(FeedBase):
return out.read()
def tohtml(self):
if DictLoader is None:
raise ImportError('dep wheezy.template needed')
path = os.path.join(os.path.dirname(__file__), 'reader.html.template')
loader = DictLoader({'reader': open(path).read()})
engine = Engine(loader=loader, extensions=[CoreExtension()])