From 8418212475782eede3c1a6d0ea5e89ffe15a9bde Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 4 May 2015 22:26:31 +0800 Subject: [PATCH] Use good path for html template access --- morss/feeds.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/morss/feeds.py b/morss/feeds.py index 3f9a51d..4ad9fac 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys +import os.path from datetime import datetime @@ -391,7 +392,8 @@ class FeedParser(FeedBase): if DictLoader is None: 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()]) template = engine.get_template('reader') return template.render({'feed': self}).encode('utf-8')