Kaydet (Commit) b4fd9b5a authored tarafından ryabtsev's avatar ryabtsev Kaydeden (comit) Tim Graham

Fixed #29432 -- Allowed passing an integer to the slice template filter.

üst 39283c8e
......@@ -573,7 +573,7 @@ def slice_filter(value, arg):
"""
try:
bits = []
for x in arg.split(':'):
for x in str(arg).split(':'):
if not x:
bits.append(None)
else:
......
......@@ -26,6 +26,9 @@ class FunctionTests(SimpleTestCase):
def test_index(self):
self.assertEqual(slice_filter('abcdefg', '1'), 'a')
def test_index_integer(self):
self.assertEqual(slice_filter('abcdefg', 1), 'a')
def test_negative_index(self):
self.assertEqual(slice_filter('abcdefg', '-1'), 'abcdef')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment