ignore . and .. in directory listing
[qcg-portal.git] / qcg / forms.py
index f66ada6..c1fda14 100644 (file)
@@ -117,6 +117,7 @@ class JobDescriptionForm(forms.Form):
     )
 
     application = forms.ChoiceField(choices=APPLICATION_CHOICES, label=u"Aplikacja", required=False)  # TODO choices
+    master_file = forms.CharField(label=u"Plik główny", max_length=500, required=False)  # TODO grid ftp
     executable = forms.CharField(label=u"Plik wykonywalny", max_length=500, required=False)  # TODO grid ftp
     script = forms.CharField(label=u"Skrypt", widget=forms.Textarea(attrs={'rows': 2, 'cols': 40}), required=False)  # TODO saving to grid ftp
     arguments = forms.MultipleChoiceField(label=u"Argumenty", required=False)
@@ -124,7 +125,7 @@ class JobDescriptionForm(forms.Form):
     grant = forms.CharField(label=u"Grant", max_length=100, required=False)
 
     hosts = forms.MultipleChoiceField(label=u"Host", choices=Host.CHOICES, required=False)
-    properties = forms.MultipleChoiceField(label=u"Właściwości węzłów", required=False)
+    properties = forms.CharField(label=u"Właściwości węzłów", required=False)
     queue = forms.ChoiceField(choices=QUEUE_CHOICES, label=u"Kolejka", required=False)
     procs = forms.IntegerField(label=u"Liczba procesów", min_value=0, required=False)
     nodes = forms.CharField(label=u"Topologia węzłów", max_length=10, validators=[nodes_validator], required=False)
@@ -136,8 +137,8 @@ class JobDescriptionForm(forms.Form):
 
     # 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)
+    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='',
@@ -166,8 +167,9 @@ class JobDescriptionForm(forms.Form):
             # accept user defined choices
             self.fields['queue'].choices += ((data.get('queue'), data.get('queue')), )
             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['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()
@@ -195,11 +197,19 @@ 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 ''
+
+    def clean_input(self):
+        return 'gsiftp://' + self.cleaned_data['input'] if self.cleaned_data['input'] else ''
 
+    def clean_stage_in(self):
+        return ['gsiftp://' + item for item in self.cleaned_data['stage_in']]
 
 class EnvForm(forms.Form):
     name = forms.CharField(label=u"Nazwa", max_length=100, validators=[env_name_validator],