| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Handlers decorators.""" | 5 """Handlers decorators.""" |
| 6 | 6 |
| 7 import functools | 7 import functools |
| 8 import logging | 8 import logging |
| 9 | 9 |
| 10 | 10 |
| 11 def silence(*exceptions): | 11 def silence(*exceptions): |
| 12 """Eats the exceptions listed and log a warning instead of an error. | 12 """Eats the exceptions listed and log a warning instead of an error. |
| 13 | 13 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' | 50 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' |
| 51 msg = 'Only internal task %s can do this' % task_name | 51 msg = 'Only internal task %s can do this' % task_name |
| 52 if actual_name: | 52 if actual_name: |
| 53 msg += '; got %s' % actual_name | 53 msg += '; got %s' % actual_name |
| 54 logging.error(msg) | 54 logging.error(msg) |
| 55 self.abort(403, msg) | 55 self.abort(403, msg) |
| 56 return | 56 return |
| 57 return f(self, *args, **kwargs) | 57 return f(self, *args, **kwargs) |
| 58 return hook | 58 return hook |
| 59 return decorator | 59 return decorator |
| OLD | NEW |