Remove support for coffin
This commit is contained in:
@@ -21,7 +21,6 @@ DATABASES = {
|
|||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'compressor',
|
'compressor',
|
||||||
'coffin',
|
|
||||||
'sekizai',
|
'sekizai',
|
||||||
]
|
]
|
||||||
if django.VERSION < (1, 8):
|
if django.VERSION < (1, 8):
|
||||||
|
|||||||
@@ -589,31 +589,6 @@ class OfflineCompressComplexTestCase(OfflineTestCaseMixin, TestCase):
|
|||||||
self.assertEqual(rendered_template, ''.join(result) + '\n')
|
self.assertEqual(rendered_template, ''.join(result) + '\n')
|
||||||
|
|
||||||
|
|
||||||
# Coffin does not work on Python 3.2+ due to:
|
|
||||||
# The line at coffin/template/__init__.py:15
|
|
||||||
# from library import *
|
|
||||||
# causing 'ImportError: No module named library'.
|
|
||||||
# It seems there is no evidence nor indicated support for Python 3+.
|
|
||||||
@unittest.skipIf(sys.version_info >= (3, 2), 'Coffin does not support 3.2+')
|
|
||||||
@unittest.skipIf(django.VERSION >= (1, 8), 'Import error on 1.8')
|
|
||||||
class OfflineCompressCoffinTestCase(OfflineTestCaseMixin, TestCase):
|
|
||||||
templates_dir = 'test_coffin'
|
|
||||||
expected_hash = '32c8281e3346'
|
|
||||||
engines = ('jinja2',)
|
|
||||||
|
|
||||||
def _get_jinja2_env(self):
|
|
||||||
import jinja2
|
|
||||||
from coffin.common import env
|
|
||||||
from compressor.contrib.jinja2ext import CompressorExtension
|
|
||||||
|
|
||||||
# Could have used the env.add_extension method, but it's only available
|
|
||||||
# in Jinja2 v2.5
|
|
||||||
new_env = jinja2.Environment(extensions=[CompressorExtension])
|
|
||||||
env.extensions.update(new_env.extensions)
|
|
||||||
|
|
||||||
return env
|
|
||||||
|
|
||||||
|
|
||||||
# Jingo does not work when using Python 3.2 due to the use of Unicode string
|
# 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
|
# 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
|
# 3.3 since it tolerates the use of the Unicode string prefix. Python 3.3
|
||||||
|
|||||||
@@ -24,19 +24,6 @@ From now on, you can use same code you'd normally use within Django templates::
|
|||||||
]))
|
]))
|
||||||
template.render({'STATIC_URL': settings.STATIC_URL})
|
template.render({'STATIC_URL': settings.STATIC_URL})
|
||||||
|
|
||||||
For coffin users
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Coffin_ makes it very easy to include additional Jinja2_ extensions as it
|
|
||||||
only requires to add extension to ``JINJA2_EXTENSIONS`` at main settings
|
|
||||||
module::
|
|
||||||
|
|
||||||
JINJA2_EXTENSIONS = [
|
|
||||||
'compressor.contrib.jinja2ext.CompressorExtension',
|
|
||||||
]
|
|
||||||
|
|
||||||
And that's it - our extension is loaded and ready to be used.
|
|
||||||
|
|
||||||
|
|
||||||
Jinja2 Offline Compression Support
|
Jinja2 Offline Compression Support
|
||||||
==================================
|
==================================
|
||||||
@@ -85,13 +72,10 @@ 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. Coffin_ works
|
templates. You could use Jingo_ or your own custom loader.
|
||||||
differently by providing a custom rendering method instead of a custom loader.
|
|
||||||
|
|
||||||
Unfortunately, Jingo_ does not implement such a method in its loader;
|
Unfortunately, Jingo_ does not implement such a method in its loader,
|
||||||
Coffin_ does not seem to have a template loader in the first place.
|
read on to understand how to make Compressor work nicely with Jingo_.
|
||||||
Read on to understand how to make Compressor work nicely with Jingo_
|
|
||||||
and Coffin_.
|
|
||||||
|
|
||||||
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
|
||||||
@@ -127,28 +111,6 @@ You should configure ``TEMPLATE_LOADERS`` as such::
|
|||||||
This will enable the Jingo_ loader to load Jinja2 templates and the other
|
This will enable the Jingo_ loader to load Jinja2 templates and the other
|
||||||
loaders to report the templates location(s).
|
loaders to report the templates location(s).
|
||||||
|
|
||||||
For Coffin users
|
|
||||||
----------------
|
|
||||||
You might want to configure ``TEMPLATE_LOADERS`` as such::
|
|
||||||
|
|
||||||
TEMPLATE_LOADERS = (
|
|
||||||
'django.template.loaders.filesystem.Loader',
|
|
||||||
'django.template.loaders.app_directories.Loader',
|
|
||||||
)
|
|
||||||
|
|
||||||
def COMPRESS_JINJA2_GET_ENVIRONMENT():
|
|
||||||
# TODO: ensure the CompressorExtension is installed with Coffin
|
|
||||||
# as described in the "In-Request Support" section above.
|
|
||||||
# Additional globals, filters, tests,
|
|
||||||
# and extensions used within {%compress%} blocks must be configured
|
|
||||||
# with Coffin.
|
|
||||||
from coffin.common import env
|
|
||||||
|
|
||||||
return env
|
|
||||||
|
|
||||||
Again, if you have the Jinja2 templates in the app template directories, you're
|
|
||||||
done here. Otherwise, specify the location in ``TEMPLATE_DIRS``.
|
|
||||||
|
|
||||||
Using your custom loader
|
Using your custom loader
|
||||||
------------------------
|
------------------------
|
||||||
You should configure ``TEMPLATE_LOADERS`` as such::
|
You should configure ``TEMPLATE_LOADERS`` as such::
|
||||||
@@ -164,11 +126,9 @@ use of the Django's builtin loaders to report the Jinja2 template location(s).
|
|||||||
Python 3 Support
|
Python 3 Support
|
||||||
----------------
|
----------------
|
||||||
Jingo with Jinja2 are tested and work on Python 2.6, 2.7, and 3.3.
|
Jingo with Jinja2 are tested and work on Python 2.6, 2.7, and 3.3.
|
||||||
Coffin with Jinja2 are tested and work on Python 2.6 and 2.7 only.
|
|
||||||
Jinja2 alone (with custom loader) are tested and work on Python 2.6, 2.7 and
|
Jinja2 alone (with custom loader) are tested and work on Python 2.6, 2.7 and
|
||||||
3.3 only.
|
3.3 only.
|
||||||
|
|
||||||
|
|
||||||
.. _Jinja2: http://jinja.pocoo.org/docs/
|
.. _Jinja2: http://jinja.pocoo.org/docs/
|
||||||
.. _Coffin: http://pypi.python.org/pypi/Coffin
|
|
||||||
.. _Jingo: https://jingo.readthedocs.org/en/latest/
|
.. _Jingo: https://jingo.readthedocs.org/en/latest/
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Jinja2==2.7.3
|
|||||||
lxml==3.4.2
|
lxml==3.4.2
|
||||||
beautifulsoup4==4.4.0
|
beautifulsoup4==4.4.0
|
||||||
unittest2==1.0.0
|
unittest2==1.0.0
|
||||||
coffin==0.4.0
|
|
||||||
jingo==0.7
|
jingo==0.7
|
||||||
django-sekizai==0.8.2
|
django-sekizai==0.8.2
|
||||||
django-overextends==0.4.0
|
django-overextends==0.4.0
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -9,7 +9,6 @@ two =
|
|||||||
beautifulsoup4==4.4.0
|
beautifulsoup4==4.4.0
|
||||||
unittest2==1.0.0
|
unittest2==1.0.0
|
||||||
jingo==0.7
|
jingo==0.7
|
||||||
coffin==0.4.0
|
|
||||||
django-sekizai==0.8.2
|
django-sekizai==0.8.2
|
||||||
django-overextends==0.4.0
|
django-overextends==0.4.0
|
||||||
csscompressor==0.9.4
|
csscompressor==0.9.4
|
||||||
@@ -24,7 +23,6 @@ three =
|
|||||||
lxml==3.4.2
|
lxml==3.4.2
|
||||||
beautifulsoup4==4.4.0
|
beautifulsoup4==4.4.0
|
||||||
jingo==0.7
|
jingo==0.7
|
||||||
coffin==0.4.0
|
|
||||||
django-sekizai==0.8.2
|
django-sekizai==0.8.2
|
||||||
django-overextends==0.4.0
|
django-overextends==0.4.0
|
||||||
csscompressor==0.9.4
|
csscompressor==0.9.4
|
||||||
@@ -39,7 +37,6 @@ three_two =
|
|||||||
lxml==3.4.2
|
lxml==3.4.2
|
||||||
beautifulsoup4==4.4.0
|
beautifulsoup4==4.4.0
|
||||||
jingo==0.7
|
jingo==0.7
|
||||||
coffin==0.4.0
|
|
||||||
django-sekizai==0.8.2
|
django-sekizai==0.8.2
|
||||||
django-overextends==0.4.0
|
django-overextends==0.4.0
|
||||||
csscompressor==0.9.4
|
csscompressor==0.9.4
|
||||||
|
|||||||
Reference in New Issue
Block a user