0002507: [Place-Dialog] "Unhandled exception" when pasting some invalid string

Fixing the bug, no features or improvements


svn: r11416
This commit is contained in:
Benny Malengier 2008-12-04 15:12:38 +00:00
parent d3cee34e11
commit 228e2b81bd

View File

@ -178,9 +178,10 @@ def conv_lat_lon(latitude, longitude, format="D.D4"):
#allow some special unicode symbols
val = val.replace( u'\u2033',r'"')
val = val.replace( u'\u2032',r"'")
#ignore spaces
val = val.replace(r'\s*', r'')
# get the degrees, must be present
#ignore spaces, a regex with \s* would be better here...
val = val.replace(r' ', r'')
val = val.replace(r'\t', r'')
# get the degrees, must be present to parse as old degree notation
if val.find(r'_') != -1:
l = val.split('_')
if len(l) != 2:
@ -492,6 +493,8 @@ if __name__ == '__main__':
test_formats_fail(lat,lon)
lat, lon = ' 50°59.60"N', ' 2°53\'E'
test_formats_success(lat,lon)
lat, lon = ' 11° 11\' 11" N, 11° 11\' 11" O', ' '
test_formats_fail(lat,lon)
# very small negative
lat, lon = '-0.00006', '-0.00006'
test_formats_success(lat,lon)