From 20baf16413fee7f5242064937a55deeab2f64bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 5 Jun 2012 12:34:37 +0200 Subject: [PATCH] allow sorting "numbers" with spaces --- tabellio/searchform/cmpfunctions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tabellio/searchform/cmpfunctions.py b/tabellio/searchform/cmpfunctions.py index b8b0e47..fe522b2 100644 --- a/tabellio/searchform/cmpfunctions.py +++ b/tabellio/searchform/cmpfunctions.py @@ -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: