Skip to content

Commit

Permalink
Merge branch 'hotfix-0.12.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
akira-dev committed Apr 4, 2017
2 parents 175057c + 6c39d80 commit 21eeca7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion flask_rest_jsonapi/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion flask_rest_jsonapi/querystring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []

Expand Down
6 changes: 3 additions & 3 deletions flask_rest_jsonapi/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages


__version__ = '0.12.1'
__version__ = '0.12.2'


setup(
Expand Down

0 comments on commit 21eeca7

Please sign in to comment.