|
|
@ -329,7 +329,7 @@ class FormConfig: |
|
|
|
form_list.append(form_def) |
|
|
|
form_list.append(form_def) |
|
|
|
return form_list |
|
|
|
return form_list |
|
|
|
|
|
|
|
|
|
|
|
def callback(self, form_name, form_values, stdout, stderr): |
|
|
|
def callback(self, form_name, form_values, stdout=None, stderr=None): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Perform a callback for the form `form_name`. This calls a script. |
|
|
|
Perform a callback for the form `form_name`. This calls a script. |
|
|
|
`form_values` is a dictionary of validated values as returned by |
|
|
|
`form_values` is a dictionary of validated values as returned by |
|
|
@ -340,6 +340,10 @@ class FormConfig: |
|
|
|
""" |
|
|
|
""" |
|
|
|
form = self.get_form_def(form_name) |
|
|
|
form = self.get_form_def(form_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Validate params |
|
|
|
|
|
|
|
if form.output == 'raw' and (stdout is None or stderr is None): |
|
|
|
|
|
|
|
raise ValueError('stdout and stderr cannot be None if script output is \'raw\'') |
|
|
|
|
|
|
|
|
|
|
|
# Pass form values to the script through the environment as strings. |
|
|
|
# Pass form values to the script through the environment as strings. |
|
|
|
env = os.environ.copy() |
|
|
|
env = os.environ.copy() |
|
|
|
for k, v in form_values.items(): |
|
|
|
for k, v in form_values.items(): |
|
|
|