diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2017-01-25 17:42:07 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2017-01-25 17:43:00 -0200 |
commit | 772592f612d615e3a1b1486d33edca4d298f0d04 (patch) | |
tree | aa6a2188f6b3f387e750506947d13df6bf9a8631 /service/pixelated/resources/__init__.py | |
parent | 012d1f0b8ec7fa2e45043e59071a87f050cf9f5d (diff) |
Extract duplicated methods to a common parent
Diffstat (limited to 'service/pixelated/resources/__init__.py')
-rw-r--r-- | service/pixelated/resources/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/service/pixelated/resources/__init__.py b/service/pixelated/resources/__init__.py index 11611f0b..6bac2f59 100644 --- a/service/pixelated/resources/__init__.py +++ b/service/pixelated/resources/__init__.py @@ -15,6 +15,7 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. import json +import os from twisted.web.http import UNAUTHORIZED from twisted.web.resource import Resource @@ -56,6 +57,18 @@ def handle_error_deferred(e, request): request.finish() +def get_startup_folder(): + path = os.path.dirname(os.path.abspath(__file__)) + return os.path.join(path, '..', 'assets') + + +def get_static_folder(): + static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "dist")) + if not os.path.exists(static_folder): + static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent') + return static_folder + + class BaseResource(Resource): def __init__(self, services_factory): |