mintchaos / typogrify

A set of Django template filters to make caring about typography on the web a bit easier.
http://static.mintchaos.com/projects/typogrify/
Other
167 stars 29 forks source link

Jinja2 required for Django 1.9 #44

Open evenicoulddoit opened 8 years ago

evenicoulddoit commented 8 years ago

Unless Jinja2 is pip installed, I get the following error on Django 1.9:

django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'typogrify.templatetags.jinja_filters': No module named jinja2

Didn't have Jinja2 installed previously and was working fine on Django 1.8

davejacobs commented 8 years ago

+1

chrisdrackett commented 8 years ago

happy to accept pull requests :) I'm not currently actively working on any django projects and haven't updated anything to 1.9 yet.

tBaxter commented 8 years ago

I've run into this too. It's coming from the templatetags.jinja_filters, in the import jinja2 line. The part I don't understand is why 1.9 is attempting to load that tag at all. There's either a bug in 1.9, or something very poorly documented.

tBaxter commented 8 years ago

I believe this is a defect in Django: https://code.djangoproject.com/ticket/26164

timgraham commented 8 years ago

This is a backwards-incompatible change in Django 1.9 as described in the release notes: https://github.com/django/django/commit/655f52491505932ef04264de2bce21a03f3a7cd0

In the template tag file you can add something like:

try:
   import jinja2
except ImportError:
   jinja2 = None

and raise an error later when using the template tag if jinja2 is needed and not installed.

tBaxter commented 8 years ago

Thanks. Not actually my project, I just thought it illustrated the behavior well. I still disagree this is desirable, but can see the reasons to do it. I do think further documentation is in order on the behavior and how to mitigate unwanted side effects, and would like to propose an exclude_tags template setting that would allow one to block problematic tag loading as needed.

Sent from my iPhone

On Feb 1, 2016, at 5:24 PM, Tim Graham notifications@github.com wrote:

This is a backwards-incompatible change in Django 1.9 as described in the release notes: django/django@655f524

In the template tag file you can add something like:

try: import jinja2 except ImportError: jinja2 = None and raise an error later when using the template tag if jinja2 is needed and not installed.

— Reply to this email directly or view it on GitHub.