Skip to content

Function _http_view_func_wrapper should use @functools.wraps #178

Closed
@svleeuwen

Description

@svleeuwen

For example when using Flask-Talisman you can specify per-view options using:

@functions_framework.http
@talisman(content_security_policy=None)
def foo(request):
    ...

Talisman will decorate the view function with a talisman_view_options attribute which is retrieved later like this:

view_options = getattr(view_function, 'talisman_view_options', {})

Adding functools.wraps makes sure all function attributes are copied from the original function to the _http_view_func_wrapper.

Will create a pull request for this in a minute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions