enhancements in selecting file from gridftp & moved submitting jobs to separate file
[qcg-portal.git] / qcg / forms.py
index 33eeeaf..74eec37 100644 (file)
@@ -136,9 +136,9 @@ class JobDescriptionForm(forms.Form):
     reservation = forms.CharField(label=u"Rezerwacja", max_length=100, required=False)
 
     # TODO grid ftp
-    input = forms.CharField(label=u"Standardowe wejście", max_length=500, required=False)
-    stage_in = forms.CharField(label=u"Stage in", max_length=500, required=False)
-    stage_out = forms.CharField(label=u"Stage out", max_length=500, required=False)
+    input = forms.MultipleChoiceField(label=u"Standardowe wejście", required=False)
+    stage_in = forms.MultipleChoiceField(label=u"Stage in", required=False)
+    # stage_out = forms.MultipleChoiceField(label=u"Stage out", required=False)
 
     monitoring = forms.BooleanField(label=u"Portal QCG-Monitoring", required=False)
     notify_type = forms.ChoiceField(label=u"Monitorowanie stanu", choices=PROTOCOL_CHOICES, required=False, initial='',
@@ -169,6 +169,9 @@ class JobDescriptionForm(forms.Form):
             self.fields['arguments'].choices += ((v, v) for v in data.getlist('arguments'))
             self.fields['properties'].choices += ((v, v) for v in data.getlist('properties'))
             self.fields['native'].choices += ((v, v) for v in data.getlist('native'))
+            self.fields['input'].choices += ((v, v) for v in data.getlist('input'))
+            self.fields['stage_in'].choices += ((v, v) for v in data.getlist('stage_in'))
+            # self.fields['stage_out'].choices += ((v, v) for v in data.getlist('stage_out'))
 
     def clean(self):
         data = super(JobDescriptionForm, self).clean()
@@ -196,10 +199,13 @@ class JobDescriptionForm(forms.Form):
             data['postprocess'] = ''
 
     def clean_application(self):
-        return self.cleaned_data['application'].split('/', 1)
+        return self.cleaned_data['application'].split('/', 1) if self.cleaned_data['application'] else ''
+
+    def clean_executable(self):
+        return 'gsiftp://' + self.cleaned_data['executable'] if self.cleaned_data['executable'] else ''
 
     def clean_nodes(self):
-        return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else None
+        return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else ''
 
 
 class EnvForm(forms.Form):