Ticket #6904: dictsort.patch

File dictsort.patch, 805 bytes (added by mathwizard, 17 years ago)

Patch against current svn patching dictsort and dictsortreversed filters

  • defaultfilters.py

     
    418418    """
    419419    var_resolve = Variable(arg).resolve
    420420    decorated = [(var_resolve(item), item) for item in value]
    421     decorated.sort()
     421    import operator
     422    decorated.sort(key=lambda x: unicode.lower(x[0]))
    422423    return [item[1] for item in decorated]
    423424dictsort.is_safe = False
    424425
     
    429430    """
    430431    var_resolve = Variable(arg).resolve
    431432    decorated = [(var_resolve(item), item) for item in value]
    432     decorated.sort()
     433    import operator
     434    decorated.sort(key=lambda x: unicode.lower(x[0]))
    433435    decorated.reverse()
    434436    return [item[1] for item in decorated]
    435437dictsortreversed.is_safe = False
Back to Top