From d397b83dc88a515420665b178e9260b592ee905a Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Wed, 28 Aug 2019 15:50:02 +0200 Subject: [PATCH] Avoid alphabetic characters in filter rules --- gramps/gen/filters/rules/place/_withinarea.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gramps/gen/filters/rules/place/_withinarea.py b/gramps/gen/filters/rules/place/_withinarea.py index 2e3ea4b35..31358d426 100644 --- a/gramps/gen/filters/rules/place/_withinarea.py +++ b/gramps/gen/filters/rules/place/_withinarea.py @@ -30,6 +30,7 @@ #------------------------------------------------------------------------- from math import pi, cos, hypot +import re #------------------------------------------------------------------------- # @@ -77,7 +78,10 @@ class WithinArea(Rule): self.latitude, self.longitude = conv_lat_lon(latitude, longitude, "D.D8") - value = int(self.list[1]) + val = self.list[1] + if isinstance(val, str): + val = re.sub("\D", "", val) # suppress all alpha characters + value = int(val) unit = int(self.list[2]) # earth perimeter in kilometers for latitude # 2 * pi * (6371 * cos(latitude/180*pi))