Remove support for jingo

This commit is contained in:
Johannes Linke
2015-12-05 14:28:43 +01:00
parent ff18ca1d2e
commit d16d0b2968
5 changed files with 1 additions and 68 deletions

View File

@@ -23,8 +23,6 @@ INSTALLED_APPS = [
'compressor', 'compressor',
'sekizai', 'sekizai',
] ]
if django.VERSION < (1, 8):
INSTALLED_APPS.append('jingo')
# currently, we can't use overextends and django 1.9 since that would # currently, we can't use overextends and django 1.9 since that would
# require updating the templates settings to the new format. # require updating the templates settings to the new format.

View File

@@ -590,35 +590,6 @@ class OfflineCompressComplexTestCase(OfflineTestCaseMixin, TestCase):
self.assertEqual(rendered_template, ''.join(result) + '\n') self.assertEqual(rendered_template, ''.join(result) + '\n')
# Jingo does not work when using Python 3.2 due to the use of Unicode string
# prefix (and possibly other stuff), but it actually works when using Python
# 3.3 since it tolerates the use of the Unicode string prefix. Python 3.3
# support is also evident in its tox.ini file.
@unittest.skipIf(sys.version_info >= (3, 2) and sys.version_info < (3, 3),
'Jingo does not support 3.2')
@unittest.skipIf(django.VERSION >= (1, 8), 'Import error on 1.8')
class OfflineCompressJingoTestCase(OfflineTestCaseMixin, TestCase):
templates_dir = 'test_jingo'
expected_hash = '61ec584468eb'
engines = ('jinja2',)
def _get_jinja2_env(self):
import jinja2
import jinja2.ext
from jingo import env
from compressor.contrib.jinja2ext import CompressorExtension
from compressor.offline.jinja2 import SpacelessExtension, url_for
# Could have used the env.add_extension method, but it's only available
# in Jinja2 v2.5
new_env = jinja2.Environment(extensions=[
CompressorExtension, SpacelessExtension, jinja2.ext.with_])
env.extensions.update(new_env.extensions)
env.globals['url_for'] = url_for
return env
@unittest.skipIf(django.VERSION >= (1, 9), 'overextends does not yet support django 1.9') @unittest.skipIf(django.VERSION >= (1, 9), 'overextends does not yet support django 1.9')
class OfflineGenerationOverextendsTestCase(OfflineTestCaseMixin, TestCase): class OfflineGenerationOverextendsTestCase(OfflineTestCaseMixin, TestCase):
templates_dir = "test_overextends" templates_dir = "test_overextends"

View File

@@ -72,10 +72,7 @@ method, and is in the ``TEMPLATE_LOADERS`` setting.
If you're using Jinja2, you're likely to have a Jinja2 template loader in the If you're using Jinja2, you're likely to have a Jinja2 template loader in the
``TEMPLATE_LOADERS`` setting, otherwise Django won't know how to load Jinja2 ``TEMPLATE_LOADERS`` setting, otherwise Django won't know how to load Jinja2
templates. You could use Jingo_ or your own custom loader. templates.
Unfortunately, Jingo_ does not implement such a method in its loader,
read on to understand how to make Compressor work nicely with Jingo_.
By default, if you don't override the ``TEMPLATE_LOADERS`` setting, By default, if you don't override the ``TEMPLATE_LOADERS`` setting,
it will include the app directories loader that searches for templates under it will include the app directories loader that searches for templates under
@@ -88,29 +85,6 @@ the filesystem loader (``django.template.loaders.filesystem.Loader``) in the
``TEMPLATE_LOADERS`` setting and specify the custom location in the ``TEMPLATE_LOADERS`` setting and specify the custom location in the
``TEMPLATE_DIRS`` setting. ``TEMPLATE_DIRS`` setting.
For Jingo users
---------------
You should configure ``TEMPLATE_LOADERS`` as such::
TEMPLATE_LOADERS = (
'jingo.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
def COMPRESS_JINJA2_GET_ENVIRONMENT():
# TODO: ensure the CompressorExtension is installed with Jingo via
# Jingo's JINJA_CONFIG setting.
# Additional globals, filters, tests,
# and extensions used within {%compress%} blocks must be configured
# with Jingo.
from jingo import env
return env
This will enable the Jingo_ loader to load Jinja2 templates and the other
loaders to report the templates location(s).
Using your custom loader Using your custom loader
------------------------ ------------------------
You should configure ``TEMPLATE_LOADERS`` as such:: You should configure ``TEMPLATE_LOADERS`` as such::
@@ -123,12 +97,6 @@ You should configure ``TEMPLATE_LOADERS`` as such::
You could implement the `get_template_sources` method in your loader or make You could implement the `get_template_sources` method in your loader or make
use of the Django's builtin loaders to report the Jinja2 template location(s). use of the Django's builtin loaders to report the Jinja2 template location(s).
Python 3 Support
----------------
Jingo with Jinja2 are tested and work on Python 2.6, 2.7, and 3.3.
Jinja2 alone (with custom loader) are tested and work on Python 2.6, 2.7 and
3.3 only.
.. _Jinja2: http://jinja.pocoo.org/docs/ .. _Jinja2: http://jinja.pocoo.org/docs/
.. _Jingo: https://jingo.readthedocs.org/en/latest/

View File

@@ -5,7 +5,6 @@ mock==1.0.1
Jinja2==2.7.3 Jinja2==2.7.3
lxml==3.4.2 lxml==3.4.2
beautifulsoup4==4.4.0 beautifulsoup4==4.4.0
jingo==0.7
django-sekizai==0.9.0 django-sekizai==0.9.0
django-overextends==0.4.0 django-overextends==0.4.0
csscompressor==0.9.4 csscompressor==0.9.4

View File

@@ -7,7 +7,6 @@ two =
Jinja2==2.7.3 Jinja2==2.7.3
lxml==3.4.2 lxml==3.4.2
beautifulsoup4==4.4.0 beautifulsoup4==4.4.0
jingo==0.7
django-sekizai==0.9.0 django-sekizai==0.9.0
django-overextends==0.4.0 django-overextends==0.4.0
csscompressor==0.9.4 csscompressor==0.9.4
@@ -21,7 +20,6 @@ three =
Jinja2==2.7.3 Jinja2==2.7.3
lxml==3.4.2 lxml==3.4.2
beautifulsoup4==4.4.0 beautifulsoup4==4.4.0
jingo==0.7
django-sekizai==0.9.0 django-sekizai==0.9.0
django-overextends==0.4.0 django-overextends==0.4.0
csscompressor==0.9.4 csscompressor==0.9.4
@@ -35,7 +33,6 @@ three_two =
Jinja2==2.6 Jinja2==2.6
lxml==3.4.2 lxml==3.4.2
beautifulsoup4==4.4.0 beautifulsoup4==4.4.0
jingo==0.7
django-sekizai==0.9.0 django-sekizai==0.9.0
django-overextends==0.4.0 django-overextends==0.4.0
csscompressor==0.9.4 csscompressor==0.9.4