Skip to content

Check that contextfunction, etc. is True #1145

@davidism

Description

@davidism

In order to determine if the context should be passed to a function or filter, Jinja has the contextfunction and contextfilter decorators which set corresponding attributes on the functions. However, they're checked with if getattr(f, "contextfunction", 0), which causes issues for objects that are callable and have permissive __getattr__ functions, such as Mock.

Changing everything to default to False and check is True, would be good for consistency.

The full list is contextfunction, evalcontextfunction, environmentfunction, contextfilter, evalcontextfilter, and environmentcontextfilter.

Extracted from #1139

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions