use only nubers if integer contains a mixed string

This commit is contained in:
Jan Gerber 2015-04-20 09:49:35 +02:00
parent 6fbd090d58
commit 6eb08bd464

View file

@ -130,6 +130,9 @@ class Item(db.Model):
sort_type = key.get('sortType', key['type'])
if value:
if sort_type == 'integer':
if isinstance(value, str):
value = int(re.sub('[^0-9]', '', value))
else:
value = int(value)
elif sort_type == 'float':
value = float(value)