From 27b2321793c62fb2cbb00fd2830c9387a187a84f Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 17 Aug 2015 09:47:55 -0400 Subject: [PATCH] Refs #24451 -- Removed comma-separated {% cycle %} syntax per deprecation timeline. --- django/template/defaulttags.py | 9 ----- docs/ref/templates/builtins.txt | 12 ------- .../template_tests/syntax_tests/test_cycle.py | 34 +------------------ 3 files changed, 1 insertion(+), 54 deletions(-) diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index ec1b486b248..540d6c578a6 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -619,15 +619,6 @@ def cycle(parser, token): if len(args) < 2: raise TemplateSyntaxError("'cycle' tag requires at least two arguments") - if ',' in args[1]: - warnings.warn( - "The old {% cycle %} syntax with comma-separated arguments is deprecated.", - RemovedInDjango110Warning, - ) - # Backwards compatibility: {% cycle a,b %} or {% cycle a,b as foo %} - # case. - args[1:2] = ['"%s"' % arg for arg in args[1].split(",")] - if len(args) == 2: # {% cycle foo %} case. name = args[1] diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 1da27a18e6f..abc14f0cd89 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -185,18 +185,6 @@ call to ``{% cycle %}`` doesn't specify ``silent``:: {% cycle 'row1' 'row2' as rowcolors silent %} {% cycle rowcolors %} -.. deprecated:: 1.9 - - The ``{% cycle %}`` tag supports the much inferior old syntax from previous - Django versions. You shouldn't use this in any new projects, but for the - sake of the people who are still using it, here's what it looks like:: - - {% cycle row1,row2,row3 %} - - In this syntax, each value gets interpreted as a literal string, and there's - no way to specify variable values, literal commas, or spaces. Support for - this syntax will be removed in Django 1.10. - .. templatetag:: debug debug diff --git a/tests/template_tests/syntax_tests/test_cycle.py b/tests/template_tests/syntax_tests/test_cycle.py index 9b2c8abe10e..13073ef26d2 100644 --- a/tests/template_tests/syntax_tests/test_cycle.py +++ b/tests/template_tests/syntax_tests/test_cycle.py @@ -1,6 +1,5 @@ from django.template import TemplateSyntaxError -from django.test import SimpleTestCase, ignore_warnings -from django.utils.deprecation import RemovedInDjango110Warning +from django.test import SimpleTestCase from ..utils import setup @@ -12,24 +11,6 @@ class CycleTagTests(SimpleTestCase): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('cycle01') - @ignore_warnings(category=RemovedInDjango110Warning) - @setup({'cycle02': '{% cycle a,b,c as abc %}{% cycle abc %}'}) - def test_cycle02(self): - output = self.engine.render_to_string('cycle02') - self.assertEqual(output, 'ab') - - @ignore_warnings(category=RemovedInDjango110Warning) - @setup({'cycle03': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}'}) - def test_cycle03(self): - output = self.engine.render_to_string('cycle03') - self.assertEqual(output, 'abc') - - @ignore_warnings(category=RemovedInDjango110Warning) - @setup({'cycle04': '{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}'}) - def test_cycle04(self): - output = self.engine.render_to_string('cycle04') - self.assertEqual(output, 'abca') - @setup({'cycle05': '{% cycle %}'}) def test_cycle05(self): with self.assertRaises(TemplateSyntaxError): @@ -40,24 +21,11 @@ class CycleTagTests(SimpleTestCase): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('cycle06') - @ignore_warnings(category=RemovedInDjango110Warning) @setup({'cycle07': '{% cycle a,b,c as foo %}{% cycle bar %}'}) def test_cycle07(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('cycle07') - @ignore_warnings(category=RemovedInDjango110Warning) - @setup({'cycle08': '{% cycle a,b,c as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}'}) - def test_cycle08(self): - output = self.engine.render_to_string('cycle08') - self.assertEqual(output, 'abbbcc') - - @ignore_warnings(category=RemovedInDjango110Warning) - @setup({'cycle09': '{% for i in test %}{% cycle a,b %}{{ i }},{% endfor %}'}) - def test_cycle09(self): - output = self.engine.render_to_string('cycle09', {'test': list(range(5))}) - self.assertEqual(output, 'a0,b1,a2,b3,a4,') - @setup({'cycle10': "{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}"}) def test_cycle10(self): output = self.engine.render_to_string('cycle10')