Mercurial > piecrust2
comparison piecrust/serving.py @ 223:7decf00eee47
serve: Don't expose the debug info right away when running with `--debug`.
The `--debug` flag controls logging level and how errors are reported by the
server. Appending `?!debug` now is the only thing that shows the debug window.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 03 Feb 2015 18:50:58 -0800 |
parents | d7a548ebcd58 |
children | 4f00bb99400e |
comparison
equal
deleted
inserted
replaced
222:1446dbc42d39 | 223:7decf00eee47 |
---|---|
123 response = self._try_serve_asset(environ, request) | 123 response = self._try_serve_asset(environ, request) |
124 if response is not None: | 124 if response is not None: |
125 return response(environ, start_response) | 125 return response(environ, start_response) |
126 | 126 |
127 # Create the app for this request. | 127 # Create the app for this request. |
128 rq_debug = ('!debug' in request.args) | 128 app = PieCrust(root_dir=self.root_dir, debug=self.debug) |
129 app = PieCrust(root_dir=self.root_dir, debug=(self.debug or rq_debug)) | |
130 app.config.set('site/root', '/') | 129 app.config.set('site/root', '/') |
131 app.config.set('site/pretty_urls', True) | 130 app.config.set('site/pretty_urls', True) |
132 app.config.set('server/is_serving', True) | 131 app.config.set('server/is_serving', True) |
132 if (app.config.get('site/enable_debug_info') and | |
133 '!debug' in request.args): | |
134 app.config.set('site/show_debug_info', True) | |
133 | 135 |
134 # We'll serve page assets directly from where they are. | 136 # We'll serve page assets directly from where they are. |
135 app.env.base_asset_url_format = '/_asset/%path%' | 137 app.env.base_asset_url_format = '/_asset/%path%' |
136 | 138 |
137 # Let's see if it can be a page asset. | 139 # Let's see if it can be a page asset. |