From: Maciej Tronowski Date: Fri, 6 Mar 2015 15:50:05 +0000 (+0100) Subject: fix processing with no values X-Git-Tag: v1.0~131 X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=07160bcc9fb6355721773058d3fa236021f8c534;p=qcg-portal.git fix processing with no values --- diff --git a/qcg/forms.py b/qcg/forms.py index ea08046..f66ada6 100644 --- a/qcg/forms.py +++ b/qcg/forms.py @@ -198,7 +198,7 @@ class JobDescriptionForm(forms.Form): return self.cleaned_data['application'].split('/', 1) def clean_nodes(self): - return map(int, self.cleaned_data['nodes'].split(':', 2)) + return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else None class EnvForm(forms.Form): diff --git a/qcg/views.py b/qcg/views.py index 53491cc..d1b2880 100644 --- a/qcg/views.py +++ b/qcg/views.py @@ -170,10 +170,14 @@ def job_new(request): if form.cleaned_data[name]: setattr(desc, name, form.cleaned_data[name]) - desc.set_application(*form.cleaned_data['application']) - desc.set_nodes(*form.cleaned_data['nodes']) - desc.set_reservation(form.cleaned_data['reservation']) - desc.set_watch_output(form.cleaned_data['watch_output'], form.cleaned_data['watch_output_pattern']) + if form.cleaned_data['application']: + desc.set_application(*form.cleaned_data['application']) + if form.cleaned_data['nodes']: + desc.set_nodes(*form.cleaned_data['nodes']) + if form.cleaned_data['reservation']: + desc.set_reservation(form.cleaned_data['reservation']) + if form.cleaned_data['watch_output']: + desc.set_watch_output(form.cleaned_data['watch_output'], form.cleaned_data['watch_output_pattern']) desc.env_variables += [(env['name'], env['value']) for env in env_formset.cleaned_data if not env['DELETE']] # TODO script # TODO executable