Ticket #11008: dictsort.diff

File dictsort.diff, 821 bytes (added by ionut bizau, 16 years ago)
  • django/template/defaultfilters.py

     
    469469    """
    470470    var_resolve = Variable(arg).resolve
    471471    decorated = [(var_resolve(item), item) for item in value]
    472     decorated.sort()
     472    decorated.sort(lambda lhs, rhs: cmp(lhs[0], rhs[0]))
    473473    return [item[1] for item in decorated]
    474474dictsort.is_safe = False
    475475
     
    480480    """
    481481    var_resolve = Variable(arg).resolve
    482482    decorated = [(var_resolve(item), item) for item in value]
    483     decorated.sort()
    484     decorated.reverse()
     483    decorated.sort(lambda lhs, rhs: -cmp(lhs[0], rhs[0]))
    485484    return [item[1] for item in decorated]
    486485dictsortreversed.is_safe = False
    487486
Back to Top