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

Fail fast on invalid Jinja2Template instantiation parameters #2568

Merged
merged 2 commits into from
Apr 20, 2024

Conversation

pdelagrave
Copy link
Contributor

@pdelagrave pdelagrave commented Apr 12, 2024

Summary

Calling Jinja2Template() with both directory and env shouldn't be allowed. When both parameters were used, the passed env was silently ignored in favor of creating a new one with the provided directory and the deprecated env_options.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Calling `Jinja2Template()` with both `directory` and `env` shouldn't be allowed. When both parameters were used, the passed `env` was silently ignored in favor of creating a new one with the provided `directory` and the deprecated `env_options`.
Copy link
Member

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

This reflects the overrides. 👍

I think we should probably remove this assertion at some point... The type checker is able to catch this anyway.

@Kludex Kludex enabled auto-merge (squash) April 20, 2024 07:53
@Kludex Kludex disabled auto-merge April 20, 2024 07:53
@Kludex Kludex enabled auto-merge (squash) April 20, 2024 07:53
@Kludex Kludex merged commit 9cf26ee into encode:master Apr 20, 2024
5 checks passed
nixroxursox pushed a commit to nixroxursox/starlette that referenced this pull request Jul 20, 2024
…e#2568)

Calling `Jinja2Template()` with both `directory` and `env` shouldn't be allowed. When both parameters were used, the passed `env` was silently ignored in favor of creating a new one with the provided `directory` and the deprecated `env_options`.
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.

2 participants