Skip to content

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

@albmarin

Description

@albmarin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions