Use good path for html template access

master
pictuga 2015-05-04 22:26:31 +08:00
parent 931fd53da6
commit 8418212475
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
import os.path
from datetime import datetime from datetime import datetime
@ -391,7 +392,8 @@ class FeedParser(FeedBase):
if DictLoader is None: if DictLoader is None:
raise ImportError('dep wheezy.template needed') raise ImportError('dep wheezy.template needed')
loader = DictLoader({'reader': open('reader.html.template').read()}) path = os.path.join(os.path.dirname(__file__), 'reader.html.template')
loader = DictLoader({'reader': open(path).read()})
engine = Engine(loader=loader, extensions=[CoreExtension()]) engine = Engine(loader=loader, extensions=[CoreExtension()])
template = engine.get_template('reader') template = engine.get_template('reader')
return template.render({'feed': self}).encode('utf-8') return template.render({'feed': self}).encode('utf-8')