Mercurial > piecrust2
diff piecrust/admin/web.py @ 812:82509bce94ca
internal: PEP8 fixup for admin panel code.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 20 Dec 2016 22:20:18 -0800 |
parents | 8f2d32f90095 |
children | dcdec4b951a1 |
line wrap: on
line diff
--- a/piecrust/admin/web.py Mon Dec 19 22:31:30 2016 -0800 +++ b/piecrust/admin/web.py Tue Dec 20 22:20:18 2016 -0800 @@ -1,6 +1,6 @@ import os.path import logging -from flask import Flask +from flask import Flask, render_template from werkzeug import SharedDataMiddleware from .blueprint import foodtruck_bp from .configuration import FoodTruckConfigNotFoundError @@ -20,22 +20,22 @@ admin_root = app.config.setdefault('FOODTRUCK_ROOT', os.getcwd()) config_path = os.path.join(admin_root, 'app.cfg') - # If we're being run as the `chef admin run` command, from inside a PieCrust - # website, do a few things differently. + # If we're being run as the `chef admin run` command, from inside a + # PieCrust website, do a few things differently. app.config['FOODTRUCK_PROCEDURAL_CONFIG'] = None if (app.config.get('FOODTRUCK_CMDLINE_MODE', False) and os.path.isfile(os.path.join(admin_root, 'config.yml'))): app.secret_key = os.urandom(22) app.config['LOGIN_DISABLED'] = True app.config['FOODTRUCK_PROCEDURAL_CONFIG'] = { - 'sites': { - 'local': admin_root} - } + 'sites': { + 'local': admin_root} + } # Add a special route for the `.well-known` directory. app.wsgi_app = SharedDataMiddleware( - app.wsgi_app, - {'/.well-known': os.path.join(admin_root, '.well-known')}) + app.wsgi_app, + {'/.well-known': os.path.join(admin_root, '.well-known')}) if os.path.isfile(config_path): app.config.from_pyfile(config_path) @@ -50,16 +50,15 @@ @app.errorhandler(InvalidSiteError) def _on_invalid_site(ex): - data = {'error': "The was an error with your configuration file: %s" % + data = {'error': + "The was an error with your configuration file: %s" % str(ex)} return render_template('error.html', **data) - _missing_secret_key = False if not app.secret_key: # If there's no secret key, create a temp one but mark the app as not # correctly installed so it shows the installation information page. app.secret_key = 'temp-key' - _missing_secret_key = True # Register extensions and blueprints. app.register_blueprint(foodtruck_bp)