# HG changeset patch # User Ludovic Chabant # Date 1423018258 28800 # Node ID 7decf00eee4786ce2a5bd5aa50d0d2368e8ecd98 # Parent 1446dbc42d397d4475ec5fbe719e8e9344f78eb5 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. diff -r 1446dbc42d39 -r 7decf00eee47 piecrust/app.py --- 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') diff -r 1446dbc42d39 -r 7decf00eee47 piecrust/data/builder.py --- 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) diff -r 1446dbc42d39 -r 7decf00eee47 piecrust/serving.py --- 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%'