Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup argument does not get passed to pre event hook with certain resource urls #1283

Closed
albmarin opened this issue Jun 5, 2019 · 0 comments
Milestone

Comments

@albmarin
Copy link
Contributor

albmarin commented Jun 5, 2019

Expected Behavior

If a resource has a url and item_lookup that matches the following:

"url": "user/<regex('[a-f0-9]{24}'):_id>/tasks",
"item_lookup": False,

The pre_event hook should provide lookup as the following

def pre_GET_tasks(request, lookup):
    print(lookup)

{'_id': '5ce302e4ef986650a11340fd'}

Actual Behavior

Instead lookup is empty.

I noticed that in the pre_event decorator this issue is solved by combining args with kwargs

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

Is there a reason why this bit of code is not moved to the top of the function and the combined_args passed to the pre_event hooks instead of kwargs?

Environment

  • Python version: 3.6
  • Eve version: 0.9.1
@albmarin albmarin changed the title Lookup argument does not get passed to pre_METHOD_resource hook with certain resource urls Lookup argument does not get passed to pre event hook with certain resource urls Jun 6, 2019
@nicolaiarocci nicolaiarocci added this to the 0.9.2 milestone Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants