diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-24 19:00:32 -0400 |
---|---|---|
committer | Kali Kaneko <kali@futeisha.org> | 2017-07-24 14:38:11 -0400 |
commit | 8b7cb47f79125680544abba7e5d6a8db862350ab (patch) | |
tree | 4fa5abb688494e220edea86d7b6a69f4dff3c8b0 | |
parent | 414346683eb57fa13b6b04308ccf033024021f39 (diff) |
[feature] allow to pass a static_folder to RootResource
in this way, I can pass the pixelated_www.__path__ directly.
-rw-r--r-- | service/pixelated/resources/__init__.py | 10 | ||||
-rw-r--r-- | service/pixelated/resources/root_resource.py | 6 | ||||
-rw-r--r-- | web-ui/setup.py | 1 |
3 files changed, 10 insertions, 7 deletions
diff --git a/service/pixelated/resources/__init__.py b/service/pixelated/resources/__init__.py index 61e60720..9dae4a61 100644 --- a/service/pixelated/resources/__init__.py +++ b/service/pixelated/resources/__init__.py @@ -57,12 +57,14 @@ def handle_error_deferred(e, request): request.finish() -def get_protected_static_folder(): - return os.path.join(_get_static_folder(), 'protected') +def get_protected_static_folder(static_folder=None): + static = static_folder or _get_static_folder() + return os.path.join(static, 'protected') -def get_public_static_folder(): - return os.path.join(_get_static_folder(), 'public') +def get_public_static_folder(static_folder=None): + static = static_folder or _get_static_folder() + return os.path.join(static, 'public') def _get_static_folder(): diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py index 896bc24b..b014a590 100644 --- a/service/pixelated/resources/root_resource.py +++ b/service/pixelated/resources/root_resource.py @@ -50,10 +50,10 @@ MODE_RUNNING = 2 class RootResource(BaseResource): - def __init__(self, services_factory): + def __init__(self, services_factory, static_folder=None): BaseResource.__init__(self, services_factory) - self._public_static_folder = get_public_static_folder() - self._protected_static_folder = get_protected_static_folder() + self._public_static_folder = get_public_static_folder(static_folder) + self._protected_static_folder = get_protected_static_folder(static_folder) self._html_template = open(os.path.join(self._protected_static_folder, 'index.html')).read() self._services_factory = services_factory self._child_resources = ChildResourcesMap() diff --git a/web-ui/setup.py b/web-ui/setup.py index 04c59be2..c6f99e74 100644 --- a/web-ui/setup.py +++ b/web-ui/setup.py @@ -39,6 +39,7 @@ setup(name='pixelated-www', 'sandbox.min.js', 'bower_components/jquery-file-upload/css/*', 'bower_components/font-awesome/css/*', + 'bower_components/font-awesome/fonts/*', 'css/*', 'fonts/*', 'locales/en-us/*', |