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 /service/pixelated | |
parent | 414346683eb57fa13b6b04308ccf033024021f39 (diff) |
[feature] allow to pass a static_folder to RootResource
in this way, I can pass the pixelated_www.__path__ directly.
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/resources/__init__.py | 10 | ||||
-rw-r--r-- | service/pixelated/resources/root_resource.py | 6 |
2 files changed, 9 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() |