allow sorting "numbers" with spaces

This commit is contained in:
Frédéric Péters 2012-06-05 12:34:37 +02:00
parent ad3ff81c9a
commit 20baf16413
1 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import re
import Missing
from tabellio.documents.typenames import MAPPING
from plone.i18n.normalizer.fr import normalizer
@ -5,6 +6,11 @@ import tabellio.config.utils
def get_no_as_int(i):
if i:
if ' ' in i:
try:
return int(re.match('\d+', i).group()
except ValueError:
return 99999
try:
return int(i.split('-')[0])
except ValueError: