From 42d241d89e529e41544cca3df48ac3c61efffc29 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:55:03 +0200 Subject: [PATCH] protect against numbers that do not have any numbers --- tabellio/searchform/cmpfunctions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tabellio/searchform/cmpfunctions.py b/tabellio/searchform/cmpfunctions.py index 9a769fe..2f3c77a 100644 --- a/tabellio/searchform/cmpfunctions.py +++ b/tabellio/searchform/cmpfunctions.py @@ -8,8 +8,8 @@ def get_no_as_int(i): if i: if ' ' in i: try: - return int(re.match('\d+', i).group()) - except ValueError: + return int(re.match('\d+', i.strip()).group()) + except (ValueError, AttributeError): return 99999 try: return int(i.split('-')[0])