[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH maposmatic] Fixed form cleaning behavior upon er
From: |
David Decotigny |
Subject: |
[Maposmatic-dev] [PATCH maposmatic] Fixed form cleaning behavior upon error |
Date: |
Sun, 19 Sep 2010 12:46:03 +0200 |
From: David Decotigny <address@hidden>
When an error occurs while processing the form's data, cleaning up the
data can result in attempting to delete non existent keys. This patch
should make the code tolerant to the half-created form data we have to
deal with in that case.
The problem happened 5 or 6 times within the last 3 weeks.
---
www/maposmatic/forms.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py
index 88543fe..1dd96ce 100644
--- a/www/maposmatic/forms.py
+++ b/www/maposmatic/forms.py
@@ -112,7 +112,8 @@ class MapRenderingJobForm(forms.ModelForm):
if val is None:
msg = _(u"Required")
self._errors['bbox'] = forms.util.ErrorList([msg])
- del cleaned_data[f]
+ if f in cleaned_data:
+ del cleaned_data[f]
# Make sure that bbox and admin modes are exclusive
cleaned_data["administrative_city"] = ''
@@ -121,7 +122,7 @@ class MapRenderingJobForm(forms.ModelForm):
# Don't try to instanciate a bounding box with empty coordinates
if self._errors:
return cleaned_data
-
+
lat_upper_left = cleaned_data.get("lat_upper_left")
lon_upper_left = cleaned_data.get("lon_upper_left")
lat_bottom_right = cleaned_data.get("lat_bottom_right")
--
1.7.0.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Maposmatic-dev] [PATCH maposmatic] Fixed form cleaning behavior upon error,
David Decotigny <=