Skip to content

templater: drop Jinja Python 2 compatibility shim#353

Merged
blackboxsw merged 2 commits into
canonical:masterfrom
OddBloke:py2
May 15, 2020
Merged

templater: drop Jinja Python 2 compatibility shim#353
blackboxsw merged 2 commits into
canonical:masterfrom
OddBloke:py2

Conversation

@OddBloke
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke commented May 6, 2020

No description provided.

Copy link
Copy Markdown
Contributor

@lucasmoura lucasmoura left a comment

Choose a reason for hiding this comment

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

For what I could understand, this is because in python2 the character representation is done through __unicode__ snd this decorator just create an abstraction to allow __str__ to also return unicode strings.

If that is the case, I can see no problems with the proposed change

Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Just tested jinja template variable render failures with this branch and missing vars are properly rendered in error messages. LGTM!

.tox/py3/bin/python3 -m cloudinit.cmd.main  query -f '{{absent}}' -i instance-data.json 
WARNING: Could not render jinja template variables in file 'query commandline': 'absent'
CI_MISSING_JINJA_VAR/absent

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.

4 participants