diff --git a/.editorconfig b/.editorconfig index 3cca7170..220eb238 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,13 +9,16 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +[*.{md,rst}] +trim_trailing_whitespace = false + # Matches multiple files with brace expansion notation # Set default charset -[*.{js,py}] +[*.{js,py,md,rst}] charset = utf-8 # 4 space indentation [*.py] indent_style = space indent_size = 4 -max_line_length = 120 +max_line_length = 119 diff --git a/README.rst b/README.rst index 3d0ef927..877d1c82 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,12 @@ If you are familiar with Sanic, Sanic-RESTPlus should be easy to pick up. It provides a coherent collection of decorators and tools to describe your API and expose its documentation properly using `Swagger`_. +Important Notice +================ + +Sanic-RestPlus version 0.4.1 (and previous versions) **does not work** on Sanic 19.12+, see this bug here: https://github.com/ashleysommer/sanicpluginsframework/issues/15 + +A fix is coming, but in the meantime, please use RestPlus with Sanic v19.6.3 or v19.9.0. Compatibility ============= diff --git a/requirements/install.pip b/requirements/install.pip index 98c4edd4..d352dee9 100644 --- a/requirements/install.pip +++ b/requirements/install.pip @@ -3,5 +3,5 @@ jsonschema methodtools sanic>=0.8.3 sanic-jinja2-spf>=0.7.5 -sanic-plugins-framework>=0.8.2 +sanic-plugins-framework>=0.8.2,<0.9.0 pytz diff --git a/sanic_restplus/__about__.py b/sanic_restplus/__about__.py index bd9025a2..bf3066b7 100644 --- a/sanic_restplus/__about__.py +++ b/sanic_restplus/__about__.py @@ -1,4 +1,4 @@ # -*- coding: latin-1 -*- # -__version__ = '0.4.1' +__version__ = '0.4.1.post1' __description__ = 'Fully featured framework for fast, easy and documented API development with Sanic' diff --git a/sanic_restplus/api.py b/sanic_restplus/api.py index 3aa138e9..672e5ed8 100644 --- a/sanic_restplus/api.py +++ b/sanic_restplus/api.py @@ -703,19 +703,19 @@ def _has_fr_route(self, request): route_endpoint_name = route_endpoint_name[len(plugin_name_prefix):] return self.owns_endpoint(route_endpoint_name) - def handle_error(self, request, e): - ''' - Error handler for the API transforms a raised exception into a Flask response, + """ + Error handler for the API transforms a raised exception into a Sanic response, with the appropriate HTTP status code and body. - - :param Exception e: the raised Exception object - - ''' + :param request: The Sanic Request object + :type request: sanic.request.Request + :param e: the raised Exception object + :type e: Exception + """ context = restplus.get_context_from_spf(self.spf_reg) app = context.app #got_request_exception.send(app._get_current_object(), exception=e) - if not isinstance(e, SanicException) and app.config['PROPAGATE_EXCEPTIONS']: + if not isinstance(e, SanicException) and app.config.get('PROPAGATE_EXCEPTIONS', False): exc_type, exc_value, tb = sys.exc_info() if exc_value is e: raise @@ -827,10 +827,8 @@ def as_postman(self, urlvars=False, swagger=False): ''' return PostmanCollectionV1(self, swagger=swagger).as_dict(urlvars=urlvars) - # TODO: Sanic, payload (as a property) cannot see the request. - #@property def payload(self, request): - '''Store the input payload in the current request context''' + """Default behaviour for payload() is just to return the request.json""" return request.json @property