support keys in sorted_strings

This commit is contained in:
j 2012-08-20 20:15:52 +02:00
parent c1a2bd4d3d
commit 3f6547f28f

View file

@ -555,5 +555,5 @@ def sort_string(string):
string = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), string) string = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), string)
return unicodedata.normalize('NFKD', string) return unicodedata.normalize('NFKD', string)
def sorted_strings(strings): def sorted_strings(strings, keys=None):
return sorted(strings, cmp=lambda a, b: cmp(sort_string(a), sort_string(b))) return sorted(strings, cmp=lambda a, b: cmp(sort_string(a), sort_string(b)), keys=keys)