changeset 409:2bb5327c4c1f

debug: Fix serving of resources now that the module moved to a sub-folder.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 25 May 2015 18:38:05 -0700
parents fd8e39254da0
children d1a472464e57
files piecrust/serving/server.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/serving/server.py	Mon May 25 18:37:34 2015 -0700
+++ b/piecrust/serving/server.py	Mon May 25 18:38:05 2015 -0700
@@ -12,7 +12,7 @@
 from werkzeug.wrappers import Request, Response
 from werkzeug.wsgi import ClosingIterator, wrap_file
 from jinja2 import FileSystemLoader, Environment
-from piecrust import CACHE_DIR
+from piecrust import CACHE_DIR, RESOURCES_DIR
 from piecrust.app import PieCrust
 from piecrust.rendering import QualifiedPage, PageRenderingContext, render_page
 from piecrust.sources.base import MODE_PARSING
@@ -158,9 +158,7 @@
         static_mount = '/__piecrust_static/'
         if request.path.startswith(static_mount):
             rel_req_path = request.path[len(static_mount):]
-            mount = os.path.join(
-                    os.path.dirname(__file__),
-                    'resources', 'server')
+            mount = os.path.join(RESOURCES_DIR, 'server')
             full_path = os.path.join(mount, rel_req_path)
             try:
                 response = self._make_wrapped_file_response(
@@ -173,7 +171,7 @@
         if request.path.startswith(debug_mount):
             rel_req_path = request.path[len(debug_mount):]
             if rel_req_path == 'pipeline_status':
-                from piecrust.server.procloop import (
+                from piecrust.serving.procloop import (
                         PipelineStatusServerSideEventProducer)
                 provider = PipelineStatusServerSideEventProducer(
                         self._proc_loop.status_queue)
@@ -459,8 +457,7 @@
 
 class ErrorMessageLoader(FileSystemLoader):
     def __init__(self):
-        base_dir = os.path.join(os.path.dirname(__file__), 'resources',
-                                'messages')
+        base_dir = os.path.join(RESOURCES_DIR, 'messages')
         super(ErrorMessageLoader, self).__init__(base_dir)
 
     def get_source(self, env, template):