diff 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
line wrap: on
line diff
--- 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%'