summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@0d.be>2012-06-05 10:57:06 (GMT)
committerFrédéric Péters <fpeters@0d.be>2012-06-05 10:57:06 (GMT)
commit45d30d4e13f5b2378c64723ee4b3cadb5828b599 (patch)
tree8c15d5d80e6dde760eb1dfb12258b303681e0b87
parent42d241d89e529e41544cca3df48ac3c61efffc29 (diff)
downloadtabellio.searchform-45d30d4e13f5b2378c64723ee4b3cadb5828b599.zip
tabellio.searchform-45d30d4e13f5b2378c64723ee4b3cadb5828b599.tar.gz
tabellio.searchform-45d30d4e13f5b2378c64723ee4b3cadb5828b599.tar.bz2
take numbers wherever they are
-rw-r--r--tabellio/searchform/cmpfunctions.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tabellio/searchform/cmpfunctions.py b/tabellio/searchform/cmpfunctions.py
index 2f3c77a..deca707 100644
--- a/tabellio/searchform/cmpfunctions.py
+++ b/tabellio/searchform/cmpfunctions.py
@@ -6,15 +6,15 @@ import tabellio.config.utils
def get_no_as_int(i):
if i:
- if ' ' in i:
- try:
- return int(re.match('\d+', i.strip()).group())
- except (ValueError, AttributeError):
- return 99999
try:
return int(i.split('-')[0])
except ValueError:
- return 99999
+ pass
+ try:
+ return re.findall('\d+', i)[0]
+ except IndexError:
+ pass
+ return 99999
return 0
class Cmp: