comparison foodtruck/web.py @ 602:c6bc0ef03f82

admin: Better UI for publishing websites. * Support multiple publish targets. * Dedicated UI for publishing. * Some UI polish.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 27 Jan 2016 18:02:25 -0800
parents effbc78b5528
children 8e1b38632702
comparison
equal deleted inserted replaced
601:effbc78b5528 602:c6bc0ef03f82
20 20
21 if app.config['DEBUG']: 21 if app.config['DEBUG']:
22 l = logging.getLogger() 22 l = logging.getLogger()
23 l.setLevel(logging.DEBUG) 23 l.setLevel(logging.DEBUG)
24 24
25 app.logger.debug("Using FoodTruck admin root: %s" % admin_root) 25 logger.debug("Using FoodTruck admin root: %s" % admin_root)
26 26
27 27
28 def after_this_request(f): 28 def after_this_request(f):
29 if not hasattr(g, 'after_request_callbacks'): 29 if not hasattr(g, 'after_request_callbacks'):
30 g.after_request_callbacks = [] 30 g.after_request_callbacks = []
71 callback(response) 71 callback(response)
72 return response 72 return response
73 73
74 74
75 if not app.config['DEBUG']: 75 if not app.config['DEBUG']:
76 app.logger.debug("Registering exception handlers.") 76 logger.debug("Registering exception handlers.")
77 77
78 @app.errorhandler(FoodTruckConfigNotFoundError) 78 @app.errorhandler(FoodTruckConfigNotFoundError)
79 def _on_config_missing(ex): 79 def _on_config_missing(ex):
80 return render_template('install.html') 80 return render_template('install.html')
81 81
82 @app.errorhandler(InvalidSiteError) 82 @app.errorhandler(InvalidSiteError)
83 def _on_invalid_site(ex): 83 def _on_invalid_site(ex):
84 data = {'error': 'invalid_site', 'exception': str(ex)} 84 data = {'error': "The was an error with your configuration file: %s" %
85 str(ex)}
85 return render_template('error.html', **data) 86 return render_template('error.html', **data)
86 87
87 88
88 @app.errorhandler 89 @app.errorhandler
89 def _on_error(ex): 90 def _on_error(ex):
137 Bcrypt = SHA512Fallback 138 Bcrypt = SHA512Fallback
138 139
139 app.bcrypt = Bcrypt(app) 140 app.bcrypt = Bcrypt(app)
140 141
141 142
142 import foodtruck.views.baking # NOQA
143 import foodtruck.views.create # NOQA 143 import foodtruck.views.create # NOQA
144 import foodtruck.views.dashboard # NOQA 144 import foodtruck.views.dashboard # NOQA
145 import foodtruck.views.edit # NOQA 145 import foodtruck.views.edit # NOQA
146 import foodtruck.views.menu # NOQA 146 import foodtruck.views.menu # NOQA
147 import foodtruck.views.preview # NOQA 147 import foodtruck.views.preview # NOQA
148 import foodtruck.views.publish # NOQA
148 import foodtruck.views.settings # NOQA 149 import foodtruck.views.settings # NOQA
149 import foodtruck.views.sources # NOQA 150 import foodtruck.views.sources # NOQA
150 151