diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 5f5003b176..d2c77508fe 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import random as random_module import re -import warnings from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation from functools import wraps from pprint import pformat @@ -11,7 +10,6 @@ from pprint import pformat from django.conf import settings from django.utils import formats, six from django.utils.dateformat import format, time_format -from django.utils.deprecation import RemovedInDjango110Warning from django.utils.encoding import force_text, iri_to_uri from django.utils.html import ( avoid_wrapping, conditional_escape, escape, escapejs, linebreaks, @@ -650,37 +648,6 @@ def unordered_list(value, autoescape=True): else: escaper = lambda x: x - def convert_old_style_list(list_): - """ - Converts old style lists to the new easier to understand format. - - The old list format looked like: - ['Item 1', [['Item 1.1', []], ['Item 1.2', []]] - - And it is converted to: - ['Item 1', ['Item 1.1', 'Item 1.2]] - """ - if not isinstance(list_, (tuple, list)) or len(list_) != 2: - return list_, False - first_item, second_item = list_ - if second_item == []: - return [first_item], True - try: - # see if second item is iterable - iter(second_item) - except TypeError: - return list_, False - old_style_list = True - new_second_item = [] - for sublist in second_item: - item, old_style_list = convert_old_style_list(sublist) - if not old_style_list: - break - new_second_item.extend(item) - if old_style_list: - second_item = new_second_item - return [first_item, second_item], old_style_list - def walk_items(item_list): item_iterator = iter(item_list) try: @@ -717,12 +684,6 @@ def unordered_list(value, autoescape=True): indent, escaper(force_text(item)), sublist)) return '\n'.join(output) - value, converted = convert_old_style_list(value) - if converted: - warnings.warn( - "The old style syntax in `unordered_list` is deprecated and will " - "be removed in Django 1.10. Use the the new format instead.", - RemovedInDjango110Warning) return mark_safe(list_formatter(value)) diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index abc14f0cd8..a21dd75caf 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -2231,12 +2231,6 @@ contains ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, then -.. deprecated:: 1.8 - - An older, more restrictive and verbose input format is also supported: - ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``. - Support for this syntax will be removed in Django 1.10. - .. templatefilter:: upper upper diff --git a/tests/template_tests/filter_tests/test_unordered_list.py b/tests/template_tests/filter_tests/test_unordered_list.py index 4fbc22a657..eab9442780 100644 --- a/tests/template_tests/filter_tests/test_unordered_list.py +++ b/tests/template_tests/filter_tests/test_unordered_list.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import unordered_list -from django.test import SimpleTestCase, ignore_warnings -from django.utils.deprecation import RemovedInDjango110Warning +from django.test import SimpleTestCase from django.utils.encoding import python_2_unicode_compatible from django.utils.safestring import mark_safe @@ -14,7 +13,6 @@ class UnorderedListTests(SimpleTestCase): output = self.engine.render_to_string('unordered_list01', {'a': ['x>', ['x>\n\t\n\t') - @ignore_warnings(category=RemovedInDjango110Warning) @setup({'unordered_list02': '{% autoescape off %}{{ a|unordered_list }}{% endautoescape %}'}) def test_unordered_list02(self): output = self.engine.render_to_string('unordered_list02', {'a': ['x>', ['x>\n\t\n\t') -@ignore_warnings(category=RemovedInDjango110Warning) -class DeprecatedUnorderedListSyntaxTests(SimpleTestCase): - - @setup({'unordered_list01': '{{ a|unordered_list }}'}) - def test_unordered_list01(self): - output = self.engine.render_to_string('unordered_list01', {'a': ['x>', [['x>\n\t
    \n\t\t
  • <y
  • \n\t
\n\t') - - @setup({'unordered_list02': '{% autoescape off %}{{ a|unordered_list }}{% endautoescape %}'}) - def test_unordered_list02(self): - output = self.engine.render_to_string('unordered_list02', {'a': ['x>', [['x>\n\t
    \n\t\t
  • \n\t
\n\t') - - @setup({'unordered_list03': '{{ a|unordered_list }}'}) - def test_unordered_list03(self): - output = self.engine.render_to_string('unordered_list03', {'a': ['x>', [[mark_safe('x>\n\t
    \n\t\t
  • \n\t
\n\t') - - @setup({'unordered_list04': '{% autoescape off %}{{ a|unordered_list }}{% endautoescape %}'}) - def test_unordered_list04(self): - output = self.engine.render_to_string('unordered_list04', {'a': ['x>', [[mark_safe('x>\n\t
    \n\t\t
  • \n\t
\n\t') - - @setup({'unordered_list05': '{% autoescape off %}{{ a|unordered_list }}{% endautoescape %}'}) - def test_unordered_list05(self): - output = self.engine.render_to_string('unordered_list05', {'a': ['x>', [['x>\n\t
    \n\t\t
  • \n\t
\n\t') - - class FunctionTests(SimpleTestCase): def test_list(self): @@ -171,27 +140,3 @@ class FunctionTests(SimpleTestCase): unordered_list(item_generator(), autoescape=False), '\t
  • ulitem-a
  • \n\t
  • ulitem-b
  • \n\t
  • ulitem-c
  • ', ) - - @ignore_warnings(category=RemovedInDjango110Warning) - def test_legacy(self): - """ - Old format for unordered lists should still work - """ - self.assertEqual(unordered_list(['item 1', []]), '\t
  • item 1
  • ') - - self.assertEqual( - unordered_list(['item 1', [['item 1.1', []]]]), - '\t
  • item 1\n\t
      \n\t\t
    • item 1.1
    • \n\t
    \n\t
  • ', - ) - - self.assertEqual( - unordered_list(['item 1', [['item 1.1', []], - ['item 1.2', []]]]), '\t
  • item 1\n\t
      \n\t\t
    • item 1.1' - '
    • \n\t\t
    • item 1.2
    • \n\t
    \n\t
  • ', - ) - - self.assertEqual( - unordered_list(['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]), - '\t
  • States\n\t
      \n\t\t
    • Kansas\n\t\t
        \n\t\t\t
      • Lawrence
      • ' - '\n\t\t\t
      • Topeka
      • \n\t\t
      \n\t\t
    • \n\t\t
    • Illinois
    • \n\t
    \n\t
  • ', - )