Remove support for coffin

This commit is contained in:
Johannes Linke
2015-12-05 10:37:16 +01:00
parent b04fecbf12
commit 5d01785185
5 changed files with 3 additions and 73 deletions

View File

@@ -21,7 +21,6 @@ DATABASES = {
INSTALLED_APPS = [
'django.contrib.staticfiles',
'compressor',
'coffin',
'sekizai',
]
if django.VERSION < (1, 8):

View File

@@ -589,31 +589,6 @@ class OfflineCompressComplexTestCase(OfflineTestCaseMixin, TestCase):
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
# 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

View File

@@ -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})
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
==================================
@@ -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
``TEMPLATE_LOADERS`` setting, otherwise Django won't know how to load Jinja2
templates. You could use Jingo_ or your own custom loader. Coffin_ works
differently by providing a custom rendering method instead of a custom loader.
templates. You could use Jingo_ or your own custom 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_
and Coffin_.
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,
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
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
------------------------
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
----------------
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
3.3 only.
.. _Jinja2: http://jinja.pocoo.org/docs/
.. _Coffin: http://pypi.python.org/pypi/Coffin
.. _Jingo: https://jingo.readthedocs.org/en/latest/

View File

@@ -6,7 +6,6 @@ Jinja2==2.7.3
lxml==3.4.2
beautifulsoup4==4.4.0
unittest2==1.0.0
coffin==0.4.0
jingo==0.7
django-sekizai==0.8.2
django-overextends==0.4.0

View File

@@ -9,7 +9,6 @@ two =
beautifulsoup4==4.4.0
unittest2==1.0.0
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
csscompressor==0.9.4
@@ -24,7 +23,6 @@ three =
lxml==3.4.2
beautifulsoup4==4.4.0
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
csscompressor==0.9.4
@@ -39,7 +37,6 @@ three_two =
lxml==3.4.2
beautifulsoup4==4.4.0
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
csscompressor==0.9.4