Mercurial > piecrust2
comparison piecrust/serving/middlewares.py @ 663:3ceeca7bb71c
themes: Add support for a `--theme` argument to `chef`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 01 Mar 2016 22:27:28 -0800 |
parents | 93b656f0af54 |
children | 81d9c3a3a0b5 |
comparison
equal
deleted
inserted
replaced
662:cbd5cdec0695 | 663:3ceeca7bb71c |
---|---|
38 | 38 |
39 | 39 |
40 class PieCrustDebugMiddleware(object): | 40 class PieCrustDebugMiddleware(object): |
41 """ WSGI middleware that handles debugging of PieCrust stuff. | 41 """ WSGI middleware that handles debugging of PieCrust stuff. |
42 """ | 42 """ |
43 def __init__(self, app, root_dir, debug=False, | 43 def __init__(self, app, root_dir, debug=False, theme_site=False, |
44 sub_cache_dir=None, run_sse_check=None): | 44 sub_cache_dir=None, run_sse_check=None): |
45 self.app = app | 45 self.app = app |
46 self.root_dir = root_dir | 46 self.root_dir = root_dir |
47 self.debug = debug | 47 self.debug = debug |
48 self.theme_site = theme_site | |
48 self.sub_cache_dir = sub_cache_dir | 49 self.sub_cache_dir = sub_cache_dir |
49 self.run_sse_check = run_sse_check | 50 self.run_sse_check = run_sse_check |
50 self._proc_loop = None | 51 self._proc_loop = None |
51 self._out_dir = os.path.join(root_dir, CACHE_DIR, 'server') | 52 self._out_dir = os.path.join(root_dir, CACHE_DIR, 'server') |
52 if sub_cache_dir: | 53 if sub_cache_dir: |
61 # use process forking and we end up going here twice. We only want | 62 # use process forking and we end up going here twice. We only want |
62 # to start the pipeline loop in the inner process most of the | 63 # to start the pipeline loop in the inner process most of the |
63 # time so we let the implementation tell us if this is OK. | 64 # time so we let the implementation tell us if this is OK. |
64 from piecrust.serving.procloop import ProcessingLoop | 65 from piecrust.serving.procloop import ProcessingLoop |
65 self._proc_loop = ProcessingLoop(root_dir, self._out_dir, | 66 self._proc_loop = ProcessingLoop(root_dir, self._out_dir, |
67 theme_site=theme_site, | |
66 sub_cache_dir=sub_cache_dir, | 68 sub_cache_dir=sub_cache_dir, |
67 debug=debug) | 69 debug=debug) |
68 self._proc_loop.start() | 70 self._proc_loop.start() |
69 | 71 |
70 def __call__(self, environ, start_response): | 72 def __call__(self, environ, start_response): |