diff piecrust/admin/web.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents e1cadbfddb48
children
line wrap: on
line diff
--- a/piecrust/admin/web.py	Sun Oct 29 22:46:41 2017 -0700
+++ b/piecrust/admin/web.py	Sun Oct 29 22:51:57 2017 -0700
@@ -1,7 +1,6 @@
 import os.path
 import logging
 from flask import Flask
-from werkzeug import SharedDataMiddleware
 
 
 logger = logging.getLogger(__name__)
@@ -38,14 +37,14 @@
     if app.config.get('FOODTRUCK_DEBUG_404'):
         @app.errorhandler(404)
         def page_not_found(e):
-            return _debug_page_not_found(e)
+            return _debug_page_not_found(app, e)
 
     logger.debug("Created FoodTruck app with admin root: %s" % root_dir)
 
     return app
 
 
-def _debug_page_not_found(e):
+def _debug_page_not_found(app, e):
     from flask import request, url_for
     output = []
     for rule in app.url_map.iter_rules():
@@ -60,7 +59,8 @@
             line = ("{:50s} {:20s} {}".format(rule.endpoint, methods, url))
             output.append(line)
 
-    resp = 'FOODTRUCK_ROOT_URL=%s<br/>\n' % str(app.config['FOODTRUCK_ROOT_URL'])
+    resp = 'FOODTRUCK_ROOT_URL=%s<br/>\n' % str(
+        app.config['FOODTRUCK_ROOT_URL'])
     resp += 'PATH=%s<br/>\n' % request.path
     resp += 'ENVIRON=%s<br/>\n' % str(request.environ)
     resp += 'URL RULES:<br/>\n'