aboutsummaryrefslogtreecommitdiffstats
path: root/servo/forms
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-12-10 09:01:09 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-12-10 09:01:09 +0200
commitede4b92846696806eeff5324da7b31196aee108f (patch)
tree8bc15706ebd0f0a995d65c51b9c997418395b846 /servo/forms
parente524535756b3a6dafd026161d440e3d6a94ab248 (diff)
downloadServo-ede4b92846696806eeff5324da7b31196aee108f.tar.gz
Servo-ede4b92846696806eeff5324da7b31196aee108f.tar.bz2
Servo-ede4b92846696806eeff5324da7b31196aee108f.zip
Don't check file type if not uploaded
Diffstat (limited to 'servo/forms')
-rw-r--r--servo/forms/admin.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/servo/forms/admin.py b/servo/forms/admin.py
index e69c12e..e108bfe 100644
--- a/servo/forms/admin.py
+++ b/servo/forms/admin.py
@@ -167,7 +167,12 @@ class QueueForm(BaseModelForm):
def clean_order_template(self):
from servo.lib.utils import file_type
tpl = self.cleaned_data.get('order_template')
+
+ if tpl is None: # file was not uploaded
+ return
+
ftype = file_type(tpl.file.read())
+
if ftype != 'text/html':
raise forms.ValidationError(_('Print tempates must be in HTML format'))