diff options
author | Jogi Hofmüller <jogi@mur.at> | 2011-08-11 14:44:43 +0000 |
---|---|---|
committer | Jogi Hofmüller <jogi@mur.at> | 2011-08-11 14:44:43 +0000 |
commit | 800893aafe8f62cb2fd06c1c39542adcd27dc09a (patch) | |
tree | 8770537646480704f6ad08f5e83722de6d84a577 /tools/mmd/MmdLocation.py | |
parent | - using satellite properties in osmWidget () now (diff) |
- fixed incorrect checking of longitude and latitude in Location ()
git-svn-id: https://svn.spreadspace.org/mur.sat@127 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools/mmd/MmdLocation.py')
-rw-r--r-- | tools/mmd/MmdLocation.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/mmd/MmdLocation.py b/tools/mmd/MmdLocation.py index 7a51618..c831046 100644 --- a/tools/mmd/MmdLocation.py +++ b/tools/mmd/MmdLocation.py @@ -5,12 +5,19 @@ import hashlib from cgi import parse_qs, escape from MmdDb import Db -def checkLonLat (lonlat): - if type (lonlat) != type (0.0): - lonlat = float (lonlat) - if lonlat < 0.0 or lonlat > 360.0: +def checkLongitude (longitude): + if type (longitude) != type (0.0): + longitude = float (longitude) + if longitude < -180.0 or longitude > 180.0: return False - return lonlat + return longitude + +def checkLatitude (latitude): + if type (latitude) != type (0.0): + latitude = float (latitude) + if latitude < 0.0 or latitude > 90.0: + return False + return latitude class Location: @@ -28,8 +35,8 @@ class Location: def create (self, name, longitude, latitude, is_default, user_id): self.name = name self.is_default = is_default - self.longitude = checkLonLat (longitude) - self.latitude = checkLonLat (latitude) + self.longitude = checkLonngitude (longitude) + self.latitude = checkLatitude (latitude) if not self.longitude: self.longitude = 15.44226 |