django/django — pull request #58 by bradbeattie (2012-05-11 21:05:24+00:00)
Title: Changes Django's slice filter to be consistent with extended slice syntax

This change matches Django's slice filter to be consistent with extended slice syntax.

Before:

slice_filter(['a','b','c'], "::2") == ['a','b','c'][::2]
slice_filter(['a','b','c'], ":2") == ['a','b','c'][:2]
slice_filter(['a','b','c'], "2") != ['a','b','c'][2]

After:

slice_filter(['a','b','c'], "::2") == ['a','b','c'][::2]
slice_filter(['a','b','c'], ":2") == ['a','b','c'][:2]
slice_filter(['a','b','c'], "2") == ['a','b','c'][2]

A consequence of this change is that existing templates that make use of foobar|slice:int will no longer produce the same result, though I'd argue that the above change is closer in line with what people might expect.