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

Blurbs: set autoescape in Jinja2 environment #4941

Closed
Laren-AWS opened this issue Jun 14, 2023 · 3 comments
Closed

Blurbs: set autoescape in Jinja2 environment #4941

Laren-AWS opened this issue Jun 14, 2023 · 3 comments
Assignees

Comments

@Laren-AWS
Copy link
Contributor

Laren-AWS commented Jun 14, 2023

Best practice is to set autoescape in your Jinja2 environment in render-blurbs.py:

from jinja2 import FileSystemLoader, select_autoescape

        env = Environment(
            autoescape=select_autoescape(enabled_extensions=('html', 'xml'), default_for_string=True),
            loader=FileSystemLoader(os.path.dirname(__file__)),
        )

Or similar, assuming this doesn't break anything.

@ford-at-aws
Copy link
Contributor

ford-at-aws commented Aug 29, 2023

Isn't autoescape set to True by default? Even so, I can't find the render-blurbs.py file, only a render.py file that uses this library in a best practice way (using default true setting).

Assigning back to Laren until he can clarify what the ask is here, because all of the examples of autoescape currently in our repo have it set to default true.

@ford-at-aws ford-at-aws assigned Laren-AWS and unassigned ford-at-aws Aug 29, 2023
@Laren-AWS
Copy link
Contributor Author

It's not True by default, that's the trouble--it should be but for some reason the creators didn't do it that way.

The file is here, you merged it 9 months ago: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/.doc_gen/images/render-blurbs.py

If you don't need it, I say remove the whole thing.

@Laren-AWS Laren-AWS assigned ford-at-aws and unassigned Laren-AWS Sep 5, 2023
@ford-at-aws
Copy link
Contributor

Done. #5419

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

No branches or pull requests

3 participants