diff options
author | Roald de Vries <rdevries@thoughtworks.com> | 2016-12-05 10:32:12 +0100 |
---|---|---|
committer | Roald de Vries <rdevries@thoughtworks.com> | 2016-12-05 10:32:12 +0100 |
commit | 391cc55537a97ec8b2b55662db9c63f86ab885ef (patch) | |
tree | 3dcf6adc12efa9a84e02f9340fae925b057fcb89 /service/pixelated/resources/inbox_resource.py | |
parent | a0de084e04f02a5f09d5a14b86ece156f4f6df5f (diff) |
get templates from pkg_resources
Diffstat (limited to 'service/pixelated/resources/inbox_resource.py')
-rw-r--r-- | service/pixelated/resources/inbox_resource.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/service/pixelated/resources/inbox_resource.py b/service/pixelated/resources/inbox_resource.py index d9ba86a5..13d1f298 100644 --- a/service/pixelated/resources/inbox_resource.py +++ b/service/pixelated/resources/inbox_resource.py @@ -15,6 +15,7 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. import hashlib import os +import pkg_resources from string import Template import pixelated @@ -35,9 +36,8 @@ class InboxResource(BaseResource): def __init__(self, services_factory): BaseResource.__init__(self, services_factory) self._not_quite_the_templates_folder = self._get_not_quite_the_templates_folder() - self._templates_folder = self._get_templates_folder() self._html_template = open(os.path.join(self._not_quite_the_templates_folder, 'index.html')).read() - with open(os.path.join(self._templates_folder, 'Interstitial.html')) as f: + with open(pkg_resources.resource_filename('templates', 'Interstitial.html')) as f: self.interstitial = f.read() self._mode = MODE_STARTUP @@ -48,10 +48,6 @@ class InboxResource(BaseResource): path = os.path.dirname(os.path.abspath(pixelated.__file__)) return os.path.join(path, '..', '..', 'web-ui', 'public') - def _get_templates_folder(self): - path = os.path.dirname(os.path.abspath(pixelated.__file__)) - return os.path.join(path, 'assets') - def _is_starting(self): return self._mode == MODE_STARTUP |