[feature] allow to pass a static_folder to RootResource
authorKali Kaneko (leap communications) <kali@leap.se>
Thu, 24 Mar 2016 23:00:32 +0000 (19:00 -0400)
committerKali Kaneko <kali@futeisha.org>
Mon, 24 Jul 2017 18:38:11 +0000 (14:38 -0400)
in this way, I can pass the pixelated_www.__path__ directly.

service/pixelated/resources/__init__.py
service/pixelated/resources/root_resource.py
web-ui/setup.py

index 61e6072..9dae4a6 100644 (file)
@@ -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():
index 896bc24..b014a59 100644 (file)
@@ -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()
index 04c59be..c6f99e7 100644 (file)
@@ -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/*',