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

return jinja2 template environment per docs #726

Merged
merged 1 commit into from
Jan 22, 2016

Conversation

thenewguy
Copy link
Contributor

Use the alias 'jinja2' to look up the jinja2 template engine per https://docs.djangoproject.com/en/1.9/topics/templates/#django.template.loader.engines

fix #637

engine = engines[0]
return engine.env
from django.template import engines
return engines[alias].env
Copy link
Member

Choose a reason for hiding this comment

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

I'm all for that change, but it means the exception we catch below isn't quite right. It should be IndexError, right ? Do you think you can try adding a test for that ? Something that overrides settings to omit jinja2 template configuration and then tries to access COMPRESS_JINJA2_GET_ENVIRONMENT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check again but I thought when I looked it up before the engines object raises the custom exception instead of indexerror. I'm travelling so I am not going to be able to get to this right away

Copy link
Member

Choose a reason for hiding this comment

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

You're right actually, totally forgot about that.

diox added a commit that referenced this pull request Jan 22, 2016
return jinja2 template environment per docs
@diox diox merged commit 026bc4e into django-compressor:master Jan 22, 2016
diox added a commit that referenced this pull request Jan 22, 2016
(I merged #726 into master by accident)
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