From ce71253ab5109974f6992a3df1e948ae8bd01e78 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Sun, 24 May 2015 10:03:39 +0200 Subject: [PATCH] Allow None values for stdout, stderr if script output type is not raw. --- src/scriptform.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scriptform.py b/src/scriptform.py index 6798725..8b561f9 100755 --- a/src/scriptform.py +++ b/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():