summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-12-05 17:13:13 +0100
committerRoald de Vries <rdevries@thoughtworks.com>2016-12-05 17:40:23 +0100
commit3303510d3dabc4c1efdf39c52db026229d909490 (patch)
tree452e4f87848f954722223e3271fb49638ce837ec /service/pixelated
parent84c065cd49a3aa133b591354d8851f5da22a170f (diff)
no difference between dev and prod static files
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/resources/inbox_resource.py8
-rw-r--r--service/pixelated/resources/login_resource.py12
2 files changed, 2 insertions, 18 deletions
diff --git a/service/pixelated/resources/inbox_resource.py b/service/pixelated/resources/inbox_resource.py
index 13d1f298..d0096efe 100644
--- a/service/pixelated/resources/inbox_resource.py
+++ b/service/pixelated/resources/inbox_resource.py
@@ -35,8 +35,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._html_template = open(os.path.join(self._not_quite_the_templates_folder, 'index.html')).read()
+ with open(pkg_resources.resource_filename('templates', 'index.html')) as f:
+ self._html_template = f.read()
with open(pkg_resources.resource_filename('templates', 'Interstitial.html')) as f:
self.interstitial = f.read()
self._mode = MODE_STARTUP
@@ -44,10 +44,6 @@ class InboxResource(BaseResource):
def initialize(self):
self._mode = MODE_RUNNING
- def _get_not_quite_the_templates_folder(self):
- path = os.path.dirname(os.path.abspath(pixelated.__file__))
- return os.path.join(path, '..', '..', 'web-ui', 'public')
-
def _is_starting(self):
return self._mode == MODE_STARTUP
diff --git a/service/pixelated/resources/login_resource.py b/service/pixelated/resources/login_resource.py
index 4318752e..5838003a 100644
--- a/service/pixelated/resources/login_resource.py
+++ b/service/pixelated/resources/login_resource.py
@@ -35,17 +35,6 @@ from twisted.web.template import Element, XMLFile, renderElement, renderer
log = Logger()
-def _get_static_folder():
- static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "public"))
- # this is a workaround for packaging
- if not os.path.exists(static_folder):
- static_folder = os.path.abspath(
- os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "public"))
- if not os.path.exists(static_folder):
- static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent')
- return static_folder
-
-
def parse_accept_language(all_headers):
accepted_languages = ['pt-BR', 'en-US']
languages = all_headers.get('accept-language', '').split(';')[0]
@@ -107,7 +96,6 @@ class LoginResource(BaseResource):
def __init__(self, services_factory, provider=None, disclaimer_banner=None, authenticator=None):
BaseResource.__init__(self, services_factory)
- self._static_folder = _get_static_folder()
self._disclaimer_banner = disclaimer_banner
self._provider = provider
self._authenticator = authenticator or Authenticator(provider)