Allow None values for stdout, stderr if script output type is not raw.

pull/7/head
Ferry Boender 9 years ago
parent 8c7a12e354
commit ce71253ab5
  1. 6
      src/scriptform.py

@ -329,7 +329,7 @@ class FormConfig:
form_list.append(form_def)
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.
`form_values` is a dictionary of validated values as returned by
@ -340,6 +340,10 @@ class FormConfig:
"""
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.
env = os.environ.copy()
for k, v in form_values.items():

Loading…
Cancel
Save