From 66a7a134fff2f9cd0a156fc18f5ee769f21f1f50 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Wed, 8 Jul 2015 08:42:50 +0200 Subject: [PATCH] Rename FormConfig.callback to FormConfig.run_script. --- src/formconfig.py | 2 +- src/webapp.py | 4 ++-- test/test.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/formconfig.py b/src/formconfig.py index ca20c83..2ab5392 100644 --- a/src/formconfig.py +++ b/src/formconfig.py @@ -68,7 +68,7 @@ class FormConfig(object): form_list.append(form_def) return form_list - def callback(self, form_name, form_values, stdout=None, stderr=None): + def run_script(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 diff --git a/src/webapp.py b/src/webapp.py index 145346e..7ff84e2 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -410,8 +410,8 @@ class ScriptFormWebApp(RequestHandler): log.info("User: {0}".format(username)) log.info("Variables: {0}".format(dict(form_values.items()))) - result = form_config.callback(form_name, form_values, self.wfile, - self.wfile) + result = form_config.run_script(form_name, form_values, self.wfile, + self.wfile) if form_def.output != 'raw': # Ignore everything if we're doing raw output, since it's the # scripts responsibility. diff --git a/test/test.py b/test/test.py index 573e188..fd20c80 100644 --- a/test/test.py +++ b/test/test.py @@ -49,7 +49,7 @@ class FormConfigTestCase(unittest.TestCase): """Test a callback that returns output in strings""" sf = scriptform.ScriptForm('test_formconfig_callback.json') fc = sf.get_form_config() - res = fc.callback('test_store', {}) + res = fc.run_script('test_store', {}) self.assertEquals(res['exitcode'], 33) self.assertTrue('stdout' in res['stdout']) self.assertTrue('stderr' in res['stderr']) @@ -60,7 +60,7 @@ class FormConfigTestCase(unittest.TestCase): fc = sf.get_form_config() stdout = file('tmp_stdout', 'w+') # can't use StringIO stderr = file('tmp_stderr', 'w+') - exitcode = fc.callback('test_raw', {}, stdout, stderr) + exitcode = fc.run_script('test_raw', {}, stdout, stderr) stdout.seek(0) stderr.seek(0) self.assertTrue(exitcode == 33) @@ -71,7 +71,7 @@ class FormConfigTestCase(unittest.TestCase): """ sf = scriptform.ScriptForm('test_formconfig_callback.json') fc = sf.get_form_config() - self.assertRaises(ValueError, fc.callback, 'test_raw', {}) + self.assertRaises(ValueError, fc.run_script, 'test_raw', {}) class FormDefinitionTest(unittest.TestCase):