Skip to content

Commit

Permalink
Get rid of the annoying params dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
Colton Provias committed Aug 29, 2015
1 parent c79c2b0 commit 7d9cdc9
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 237 deletions.
6 changes: 4 additions & 2 deletions CHANGES.md
@@ -1,8 +1,10 @@
# SQLAlchemy-JSONAPI Changelog

## 1.0.1 - Fixes for 1.0 Compatibility
## 2.0.0 - Interface Fix

*In Development*
*2015-08-29*

* BREAKING Replaced dict params with api_type, obj_id, and rel_key

## 1.0.0 - Start of 1.0 Compatibility

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -13,7 +13,7 @@
from setuptools import setup

setup(name='SQLAlchemy-JSONAPI',
version='1.0.1',
version='2.0.0',
url='http://github.com/coltonprovias/sqlalchemy-jsonapi',
license='MIT',
author='Colton J. Provias',
Expand Down
9 changes: 8 additions & 1 deletion sqlalchemy_jsonapi/flask.py
Expand Up @@ -177,10 +177,17 @@ def new_view(**kwargs):
}
results = self.on_request.send(self, **event_kwargs)
data = override(data, results)

args = [self.sqla.session, data, kwargs['api_type']]
if 'obj_id' in kwargs.keys():
args.append(kwargs['obj_id'])
if 'relationship' in kwargs.keys():
args.append(kwargs['relationship'])

try:
attr = '{}_{}'.format(method.name, endpoint.name).lower()
handler = getattr(self.serializer, attr)
response = handler(self.sqla.session, data, kwargs)
response = handler(*args)
results = self.on_success.send(self,
response=response,
**event_kwargs)
Expand Down

0 comments on commit 7d9cdc9

Please sign in to comment.