diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-11-14 17:04:53 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-11-14 17:04:53 +0100 |
commit | 5db6ae2fc14ebbec4b52151c7250ca0bba98bc02 (patch) | |
tree | 3bf07bc5586be907b68ec5ea24d97755c49163d6 /chimere/forms.py | |
parent | 3143718617e2e00e843355b84aa0f5c74234d827 (diff) | |
download | Chimère-5db6ae2fc14ebbec4b52151c7250ca0bba98bc02.tar.bz2 Chimère-5db6ae2fc14ebbec4b52151c7250ca0bba98bc02.zip |
Fix file form check
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 2cf463f..2380f3c 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -131,17 +131,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 |