diff --git a/sanic/sanic.py b/sanic/sanic.py index 7a9c35ad..33e16af7 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -62,7 +62,9 @@ class Sanic: def add_route(self, handler, uri, methods=None): """ - A helper method to register class instance or functions as a handler to the application url routes. + A helper method to register class instance or + functions as a handler to the application url + routes. :param handler: function or class instance :param uri: path of the URL :param methods: list or tuple of methods allowed diff --git a/sanic/utils.py b/sanic/utils.py index 8190c1d0..5d896312 100644 --- a/sanic/utils.py +++ b/sanic/utils.py @@ -16,7 +16,8 @@ async def local_request(method, uri, cookies=None, *args, **kwargs): def sanic_endpoint_test(app, method='get', uri='/', gather_request=True, - loop=None, debug=False, *request_args, **request_kwargs): + loop=None, debug=False, *request_args, + **request_kwargs): results = [] exceptions = [] @@ -34,7 +35,8 @@ def sanic_endpoint_test(app, method='get', uri='/', gather_request=True, exceptions.append(e) app.stop() - app.run(host=HOST, debug=debug, port=42101, after_start=_collect_response, loop=loop) + app.run(host=HOST, debug=debug, port=42101, + after_start=_collect_response, loop=loop) if exceptions: raise ValueError("Exception during request: {}".format(exceptions)) diff --git a/sanic/views.py b/sanic/views.py index 9cb04247..2c4dcce2 100644 --- a/sanic/views.py +++ b/sanic/views.py @@ -3,7 +3,8 @@ from .exceptions import InvalidUsage class MethodView: """ Simple class based implementation of view for the sanic. - You should implement methods(get, post, put, patch, delete) for the class to every HTTP method you want to support. + You should implement methods(get, post, put, patch, delete) for the class + to every HTTP method you want to support. For example: class DummyView(View): @@ -30,4 +31,6 @@ class MethodView: handler = getattr(self, request.method.lower(), None) if handler: return handler(request, *args, **kwargs) - raise InvalidUsage('Method {} not allowed for URL {}'.format(request.method, request.url), status_code=405) + raise InvalidUsage( + 'Method {} not allowed for URL {}'.format( + request.method, request.url), status_code=405)