maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH] Check latitude and longitude are both different


From: David MENTRE
Subject: [Maposmatic-dev] [PATCH] Check latitude and longitude are both different at job submission
Date: Mon, 30 Apr 2012 09:09:09 +0200

Signed-off-by: David MENTRE <address@hidden>
---
 www/maposmatic/forms.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py
index 03a83db..91e378c 100644
--- a/www/maposmatic/forms.py
+++ b/www/maposmatic/forms.py
@@ -188,6 +188,7 @@ class MapRenderingJobForm(forms.ModelForm):
                     = forms.util.ErrorList([msg])
 
         elif mode == 'bbox':
+            # Check bounding box corners are provided
             for f in [ "lat_upper_left", "lon_upper_left",
                        "lat_bottom_right", "lon_bottom_right" ]:
                 val = cleaned_data.get(f)
@@ -197,6 +198,21 @@ class MapRenderingJobForm(forms.ModelForm):
                     if f in cleaned_data:
                         del cleaned_data[f]
 
+            # Check latitude and longitude are different
+            if (cleaned_data.get("lat_upper_left")
+                == cleaned_data.get("lat_bottom_right")):
+                msg = _(u"Same latitude")
+                self._errors['bbox'] = forms.util.ErrorList([msg])
+                del cleaned_data["lat_upper_left"]
+                del cleaned_data["lat_bottom_right"]
+
+            if (cleaned_data.get("lon_upper_left")
+                == cleaned_data.get("lon_bottom_right")):
+                msg = _(u"Same longitude")
+                self._errors['bbox'] = forms.util.ErrorList([msg])
+                del cleaned_data["lon_upper_left"]
+                del cleaned_data["lon_bottom_right"]
+
             # Make sure that bbox and admin modes are exclusive
             cleaned_data["administrative_city"] = ''
             cleaned_data["administrative_osmid"] = None
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]