Fixed #19: allowed args is explicitly stated
Signed-off-by: Jannis Leidel <jannis@leidel.info>
This commit is contained in:
committed by
Jannis Leidel
parent
4e5aaf05f9
commit
24b67475ac
@@ -92,6 +92,6 @@ def compress(parser, token):
|
||||
|
||||
kind = args[1]
|
||||
if not kind in ['css', 'js']:
|
||||
raise template.TemplateSyntaxError("%r's argument must be 'js' or 'css'." % (args[0], ', '.join(ALLOWED_ARGS)))
|
||||
raise template.TemplateSyntaxError("%r's argument must be 'js' or 'css'." % args[0])
|
||||
|
||||
return CompressorNode(nodelist, kind)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os, re
|
||||
import gzip
|
||||
|
||||
from django.template import Template, Context
|
||||
from django.template import Template, Context, TemplateSyntaxError
|
||||
from django.test import TestCase
|
||||
from compressor import CssCompressor, JsCompressor
|
||||
from compressor.conf import settings
|
||||
@@ -231,6 +231,12 @@ class TemplatetagTestCase(TestCase):
|
||||
out = u'<script type="text/javascript" src="/media/CACHE/js/40a8e9ffb476.js" charset="utf-8"></script>'
|
||||
self.assertEqual(out, render(template, context))
|
||||
|
||||
def test_compress_tag_with_illegal_arguments(self):
|
||||
template = u"""{% load compress %}{% compress pony %}
|
||||
<script type="pony/application">unicorn</script>
|
||||
{% endcompress %}"""
|
||||
self.assertRaises(TemplateSyntaxError, render, template, {})
|
||||
|
||||
class TestStorage(CompressorFileStorage):
|
||||
"""
|
||||
Test compressor storage that gzips storage files
|
||||
|
||||
Reference in New Issue
Block a user