feat: Return handler upon decorator invocation by mylank · Pull Request #934 · apify/crawlee-python

Description

Currently, wrapping a handler with a decorator nullifies the function because it returns None in the code. See the "None" popup over here:
image

By having the router.handler function return the original input handler, we can now reuse the handler function again in other places as it's not set to None anymore. This allows for invoking the original function even after applying the decorator and for adding multiple decorators to the same handler function. The latter for example allows for using the same handler function for multiple labels (a use case I ran into).

Issues

Not applicable.

Testing

  • Added a test to ensure handler is not nullified
  • Added a test for multiple labels assigned to a single handler

Checklist

  • CI passed

Please let me know your thoughts! 🙌