Skip to content

Commit

Permalink
Revert "BROKEN: Starting implementation of query params properly"
Browse files Browse the repository at this point in the history
This reverts commit 4dcff7d.
  • Loading branch information
Anderycks committed Feb 8, 2017
1 parent 883a051 commit 3c59683
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 329 deletions.
3 changes: 1 addition & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# SQLAlchemy-JSONAPI Changelog

## 5.0.0
## 4.0.9

*Unreleased*

* BREAKING: The query data is now expected for all endpoints
* Fixed bug during testing in delete_relationship where returned resource was missing data key
* Fixed bug during testing in patch_resource where field check was failing

Expand Down
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@

from setuptools import setup
import sys
import ast

requirements = ['SQLAlchemy', 'inflection']

with open('mynewleaf/__version__.py', 'r') as f:
version = ast.parse(f.read()).body[0].value.s

if sys.version_info[0] != 3 or sys.version_info[1] < 4:
requirements.append('enum34')
requirements.append('enum34')

setup(name='SQLAlchemy-JSONAPI',
version=version,
version='4.0.9',
url='http://github.com/coltonprovias/sqlalchemy-jsonapi',
license='MIT',
author='Colton J. Provias',
Expand Down
3 changes: 1 addition & 2 deletions sqlalchemy_jsonapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
AttributeActions, Permissions, RelationshipActions,
attr_descriptor, permission_test,
relationship_descriptor)
from .version import __version__

try:
from .flaskext import FlaskJSONAPI
except ImportError:
FlaskJSONAPI = None
FlaskJSONAPI = None
3 changes: 2 additions & 1 deletion sqlalchemy_jsonapi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
MIT License
"""


try:
from enum import Enum
except ImportError:
Expand All @@ -26,4 +27,4 @@ class Endpoint(Enum):
COLLECTION = '/<api_type>'
RESOURCE = '/<api_type>/<obj_id>'
RELATED = '/<api_type>/<obj_id>/<relationship>'
RELATIONSHIP = '/<api_type>/<obj_id>/relationships/<relationship>'
RELATIONSHIP = '/<api_type>/<obj_id>/relationships/<relationship>'
10 changes: 3 additions & 7 deletions sqlalchemy_jsonapi/flaskext.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,7 @@ def _setup_adapter(self, namespace, route_prefix):
:param namespace: Prefix for generated endpoints
:param route_prefix: Prefix for route patterns
"""
self.serializer = JSONAPI(self.sqla.Model,
prefix='{}://{}{}'.format(
self.app.config['PREFERRED_URL_SCHEME'],
self.app.config['SERVER_NAME'],
route_prefix))
self.serializer = JSONAPI(self.sqla.Model, prefix='{}://{}{}'.format(self.app.config['PREFERRED_URL_SCHEME'], self.app.config['SERVER_NAME'], route_prefix))
for view in views:
method, endpoint = view
pattern = route_prefix + endpoint.value
Expand Down Expand Up @@ -224,8 +220,8 @@ def new_view(**kwargs):
try:
attr = '{}_{}'.format(method.name, endpoint.name).lower()
handler = getattr(self.serializer, attr)
handler_chain = list(self._handler_chains.get((kwargs[
'api_type'], method, endpoint), []))
handler_chain = list(self._handler_chains.get((
kwargs['api_type'], method, endpoint), []))
handler_chain.append(handler)
chained_handler = self._call_next(handler_chain)
response = chained_handler(*args)
Expand Down
Loading

0 comments on commit 3c59683

Please sign in to comment.