ticket5797: decorator_from_middleware can cause middleware hooks to run out of correct order

Now, utils.decorators.decorator_from_middleware supports multiple arguments.