+ return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else ''
+
+ def clean_executable(self):
+ return self._gsiftp_suffix(self.cleaned_data['executable'])
+
+ def clean_master_file(self):
+ return self._gsiftp_suffix(self.cleaned_data['master_file'])
+
+ def clean_input(self):
+ return self._gsiftp_suffix(self.cleaned_data['input'])
+
+ def clean_stage_in(self):
+ return [self._gsiftp_suffix(item) for item in self.cleaned_data['stage_in']]
+
+ def clean_preprocess_script(self):
+ return self._gsiftp_suffix(self.cleaned_data['preprocess_script'])
+
+ def clean_postprocess_script(self):
+ return self._gsiftp_suffix(self.cleaned_data['postprocess_script'])
+
+ @staticmethod
+ def _gsiftp_suffix(url):
+ if url:
+ return url if url.startswith('gsiftp://') else 'gsiftp://' + url
+
+ def _init_user_choices(self, name, data, initial):
+ initial = initial.get(name) if initial is not None else None
+ choices = data.getlist(name) if data is not None else []
+
+ if initial:
+ choices += initial if isinstance(initial, list) else [initial]
+ self.fields[name].initial = initial
+
+ if choices:
+ self.fields[name].choices += ((v, v) for v in choices)