| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import flask | 5 import flask |
| 6 from google.appengine.api import taskqueue | 6 from google.appengine.api import taskqueue |
| 7 import json | 7 import json |
| 8 import uuid | 8 import uuid |
| 9 | 9 |
| 10 from clovis_task import ClovisTask | 10 from frontend.clovis_task import ClovisTask |
| 11 | 11 |
| 12 | 12 |
| 13 app = flask.Flask(__name__) | 13 app = flask.Flask(__name__) |
| 14 | 14 |
| 15 | 15 |
| 16 def StartFromJson(http_body_str): | 16 def StartFromJson(http_body_str): |
| 17 """Creates a new batch of tasks from its JSON representation""" | 17 """Creates a new batch of tasks from its JSON representation""" |
| 18 task = ClovisTask.FromJson(http_body_str) | 18 task = ClovisTask.FromJson(http_body_str) |
| 19 if not task: | 19 if not task: |
| 20 return 'Invalid JSON task:\n%s\n' % http_body_str | 20 return 'Invalid JSON task:\n%s\n' % http_body_str |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 @app.errorhandler(404) | 105 @app.errorhandler(404) |
| 106 def PageNotFound(e): | 106 def PageNotFound(e): |
| 107 """Return a custom 404 error.""" | 107 """Return a custom 404 error.""" |
| 108 return 'Sorry, Nothing at this URL.', 404 | 108 return 'Sorry, Nothing at this URL.', 404 |
| 109 | 109 |
| 110 | 110 |
| 111 @app.errorhandler(500) | 111 @app.errorhandler(500) |
| 112 def ApplicationError(e): | 112 def ApplicationError(e): |
| 113 """Return a custom 500 error.""" | 113 """Return a custom 500 error.""" |
| 114 return 'Sorry, unexpected error: {}'.format(e), 499 | 114 return 'Sorry, unexpected error: {}'.format(e), 499 |
| OLD | NEW |