Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of safe_filter #723

Merged
merged 3 commits into from
Apr 4, 2023
Merged

Fix usage of safe_filter #723

merged 3 commits into from
Apr 4, 2023

Conversation

leture
Copy link
Contributor

@leture leture commented Feb 7, 2023

Hi,

safe_filter is currently applied in a way which results in the functions actually executed on template rendering not being decorated.

Old example

@safe_filter(error_output=False)
@register.filter
def is_portrait(file_):
    ...

New example after merging this PR:

@register.filter
@safe_filter(error_output=False)
def is_portrait(file_):
    ...

Order of old example resulted in register.filter being called on the actual function is_portrait and the result of this than being decorated by safe_filter. Changing order ensures that a with safe_filter decorated is_portrait is registered as template filter.

The commit 2260492 demonstrates this by just extending the tests to show the failure. Commit after this fixes it.

Please consider applying this :-)

Copy link
Contributor

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@claudep claudep merged commit a950cd3 into jazzband:master Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants