Skip to content

Commit

Permalink
Merge branch 'pull_#1284'
Browse files Browse the repository at this point in the history
Closes #1283
  • Loading branch information
nicolaiarocci committed Jun 7, 2019
2 parents 561f4a3 + 1587782 commit 354a5b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Development Lead
Patches and Contributions
`````````````````````````


- Aayush Sarva
- Alberto Marin
- Alexander Dietmüller
- Alexander Hendorf
- Amedeo Bussi
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ In Development

Fixed
~~~~~
- Lookup argument does not get passed to ``pre_<event>`` hook with certain
resource urls (`#1283`_)
- PUT requests doesn't set default values for fields that have one defined
(`#1280`_)
- PATCH crashes when normalizing default fields (`#1275`_, `#1274`_)
- The condition that avoids returning ``X-Total-Count`` when counting is
disabled also filters out the case where the resource is empty and count is
0 (`#1279`_)

.. _`#1283`: https://github.com/pyeve/eve/issues/1283
.. _`#1280`: https://github.com/pyeve/eve/issues/1280
.. _`#1275`: https://github.com/pyeve/eve/issues/1275
.. _`#1274`: https://github.com/pyeve/eve/issues/1274
Expand Down
12 changes: 7 additions & 5 deletions eve/methods/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,14 @@ def decorated(*args, **kwargs):
resource = args[0] if args else None
gh_params = ()
rh_params = ()
combined_args = kwargs

if len(args) > 1:
combined_args.update(args[1].items())

if method in ("GET", "PATCH", "DELETE", "PUT"):
gh_params = (resource, request, kwargs)
rh_params = (request, kwargs)
gh_params = (resource, request, combined_args)
rh_params = (request, combined_args)
elif method in ("POST",):
# POST hook does not support the kwargs argument
gh_params = (resource, request)
Expand All @@ -1346,9 +1351,6 @@ def decorated(*args, **kwargs):
# resource hook
getattr(app, event_name + "_" + resource)(*rh_params)

combined_args = kwargs
if len(args) > 1:
combined_args.update(args[1].items())
r = f(resource, **combined_args)
return r

Expand Down

0 comments on commit 354a5b9

Please sign in to comment.