From 4f608031495a321d95e0ee867957f23429fdbdca Mon Sep 17 00:00:00 2001 From: Tejinder Singh Date: Sun, 2 Apr 2017 09:13:05 +0100 Subject: [PATCH 1/4] Checking if Content-Type is present in the request headers --- flask_rest_jsonapi/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_rest_jsonapi/decorators.py b/flask_rest_jsonapi/decorators.py index bef1dce..7bed182 100644 --- a/flask_rest_jsonapi/decorators.py +++ b/flask_rest_jsonapi/decorators.py @@ -17,7 +17,7 @@ def check_headers(func): @wraps(func) def wrapped(*args, **kwargs): if request.method in ('POST', 'PATCH'): - if request.headers['Content-Type'] != 'application/vnd.api+json': + if 'Content-Type' not in request.headers or request.headers['Content-Type'] != 'application/vnd.api+json': error = json.dumps(jsonapi_errors([{'source': '', 'detail': "Content-Type header must be application/vnd.api+json", 'title': 'InvalidRequestHeader', From b60c135cffe683f653660f250342d1dd109619bc Mon Sep 17 00:00:00 2001 From: "susana@vearsa.com" Date: Mon, 3 Apr 2017 10:00:16 +0100 Subject: [PATCH 2/4] Returning multiple sort fields. --- flask_rest_jsonapi/querystring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_rest_jsonapi/querystring.py b/flask_rest_jsonapi/querystring.py index 36dd9cb..56bf16f 100644 --- a/flask_rest_jsonapi/querystring.py +++ b/flask_rest_jsonapi/querystring.py @@ -155,7 +155,7 @@ def sorting(self): field = get_model_field(self.schema, field) order = 'desc' if sort_field.startswith('-') else 'asc' sorting_results.append({'field': field, 'order': order}) - return sorting_results + return sorting_results return [] From cc1a317bf44cddd259ba5442b8e327c15be13986 Mon Sep 17 00:00:00 2001 From: Pierre CHAISY Date: Tue, 4 Apr 2017 10:56:39 +0200 Subject: [PATCH 3/4] fix variable name --- flask_rest_jsonapi/resource.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flask_rest_jsonapi/resource.py b/flask_rest_jsonapi/resource.py index a09e55d..bb458f4 100644 --- a/flask_rest_jsonapi/resource.py +++ b/flask_rest_jsonapi/resource.py @@ -104,7 +104,7 @@ def get(self, *args, **kwargs): self.before_get(args, kwargs) qs = QSManager(request.args, self.schema) - object_count, objects = self._data_layer.get_collection(qs, kwargs) + objects_count, objects = self._data_layer.get_collection(qs, kwargs) schema_kwargs = getattr(self, 'get_schema_kwargs', dict()) schema_kwargs.update({'many': True}) @@ -118,11 +118,11 @@ def get(self, *args, **kwargs): view_kwargs = request.view_args if getattr(self, 'view_kwargs', None) is True else dict() add_pagination_links(result, - object_count, + objects_count, qs, url_for(self.view, **view_kwargs)) - result.update({'meta': {'count': object_count}}) + result.update({'meta': {'count': objects_count}}) self.after_get(result) return result From 6c39d80b6447d5e76cccdcba02be39b1572e9b71 Mon Sep 17 00:00:00 2001 From: Pierre CHAISY Date: Tue, 4 Apr 2017 10:57:17 +0200 Subject: [PATCH 4/4] Bump version to 0.12.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3735bdf..8b1657c 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -__version__ = '0.12.1' +__version__ = '0.12.2' setup(