diff options
Diffstat (limited to 'chimere/forms.py')
-rw-r--r-- | chimere/forms.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/chimere/forms.py b/chimere/forms.py index 4b4d49f..6ab44d3 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -110,17 +110,17 @@ class ImporterAdminForm(forms.ModelForm): Verify that only one type of source is provided Verify that shapefiles are zipped ''' - if self.cleaned_data['importer_type'] == 'SHP' and \ - not self.cleaned_data['zipped']: + if self.cleaned_data.get('importer_type') == 'SHP' and \ + not self.cleaned_data.get('zipped'): raise forms.ValidationError(_(u"Shapefiles must be provided in a "\ u"zipped archive.")) - if self.cleaned_data['source'] and \ - self.cleaned_data['source_file']: + if self.cleaned_data.get('source') and \ + self.cleaned_data.get('source_file'): raise forms.ValidationError(_(u"You have to set \"source\" or " u"\"source file\" but not both.")) - if not self.cleaned_data['source'] and \ - not self.cleaned_data['source_file'] and \ - self.cleaned_data['importer_type'] != 'OSM': + if not self.cleaned_data.get('source') and \ + not self.cleaned_data.get('source_file') and \ + self.cleaned_data.get('importer_type') != 'OSM': raise forms.ValidationError(_(u"You have to set \"source\" or " u"\"source file\".")) return self.cleaned_data |