From f09e4205cf80cabfbaec1526b163934e2754c6f1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 16 May 2012 12:31:44 +0200 Subject: [PATCH] sort_string, sorted_strings moved to ox --- pandora/item/utils.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pandora/item/utils.py b/pandora/item/utils.py index 7e71eeaf..0dbf16be 100644 --- a/pandora/item/utils.py +++ b/pandora/item/utils.py @@ -5,6 +5,7 @@ from decimal import Decimal import re import unicodedata import ox +from ox import sorted_strings, sort_string def safe_filename(filename): filename = filename.replace(': ', '_ ') @@ -46,17 +47,6 @@ def plural_key(term): 'country': 'countries', }.get(term, term + 's') - -def sort_string(string): - string = string.replace(u'Æ', 'AE').replace(u'Ø', 'O').replace(u'Þ', 'Th') - - #pad numbered titles - string = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), string) - return unicodedata.normalize('NFKD', string) - -def sorted_strings(strings): - return sorted(strings, cmp=lambda a, b: cmp(sort_string(a), sort_string(b))) - def sort_title(title): title = title.replace(u'Æ', 'Ae')