Mercurial > piecrust2
changeset 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 | 1446dbc42d39 |
children | 4f00bb99400e |
files | piecrust/app.py piecrust/data/builder.py piecrust/serving.py |
diffstat | 3 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/app.py Tue Feb 03 18:48:13 2015 -0800 +++ b/piecrust/app.py Tue Feb 03 18:50:58 2015 -0800 @@ -123,6 +123,7 @@ 'cache_time': 28800, 'display_errors': True, 'enable_debug_info': True, + 'show_debug_info': False, 'use_default_content': True }) sitec = values.get('site')
--- a/piecrust/data/builder.py Tue Feb 03 18:48:13 2015 -0800 +++ b/piecrust/data/builder.py Tue Feb 03 18:50:58 2015 -0800 @@ -59,7 +59,7 @@ # Do this at the end because we want all the data to be ready to be # displayed in the debugger window. - if (app.debug and app.config.get('site/enable_debug_info') and + if (app.config.get('site/show_debug_info') and not app.config.get('baker/is_baking')): pc_data._enableDebugInfo(page, data)
--- a/piecrust/serving.py Tue Feb 03 18:48:13 2015 -0800 +++ b/piecrust/serving.py Tue Feb 03 18:50:58 2015 -0800 @@ -125,11 +125,13 @@ return response(environ, start_response) # Create the app for this request. - rq_debug = ('!debug' in request.args) - app = PieCrust(root_dir=self.root_dir, debug=(self.debug or rq_debug)) + app = PieCrust(root_dir=self.root_dir, debug=self.debug) app.config.set('site/root', '/') app.config.set('site/pretty_urls', True) app.config.set('server/is_serving', True) + if (app.config.get('site/enable_debug_info') and + '!debug' in request.args): + app.config.set('site/show_debug_info', True) # We'll serve page assets directly from where they are. app.env.base_asset_url_format = '/_asset/%path%'