Better code quality for within area rule
This commit is contained in:
parent
7100c51a31
commit
7979bf79fd
@ -37,10 +37,10 @@ import re
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.errors import FilterError
|
||||
from ....const import GRAMPS_LOCALE as glocale
|
||||
from .. import Rule
|
||||
from ....utils.place import conv_lat_lon
|
||||
from gramps.gen.errors import FilterError
|
||||
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
@ -81,13 +81,13 @@ class WithinArea(Rule):
|
||||
"D.D8")
|
||||
if self.latitude is None or self.longitude is None:
|
||||
raise FilterError(_("Cannot use the filter 'within area'"),
|
||||
_("The place you selected contains bad coordinates. "
|
||||
"Please, run the tool 'clean input data'"))
|
||||
return
|
||||
_("The place you selected contains bad"
|
||||
" coordinates. Please, run the tool "
|
||||
"'clean input data'"))
|
||||
|
||||
val = self.list[1]
|
||||
if isinstance(val, str):
|
||||
val = re.sub(r"\D", "", val) # suppress all alpha characters
|
||||
val = re.sub(r"\D", "", val) # suppress all alpha characters
|
||||
value = int(val)
|
||||
unit = int(self.list[2])
|
||||
# earth perimeter in kilometers for latitude
|
||||
|
Loading…
Reference in New Issue
Block a user