diff --git a/src/scriptform.py b/src/scriptform.py index b0a8096..00d0b2c 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -86,7 +86,13 @@ class ScriptForm: users = config['users'] for form in config['forms']: form_name = form['name'] - script = form['script'] + if not form['script'].startswith('/'): + # Script is relative to the current dir + script = os.path.join(os.path.realpath(os.curdir), + form['script']) + else: + # Absolute path to the script + script = form['script'] forms.append( FormDefinition(form_name, form['title'], @@ -124,6 +130,10 @@ class ScriptForm: self.running = False def shutdown(self): + """ + Shutdown the server. This interupts the run() method and must thus be + run in a seperate thread. + """ self.log.info("Attempting server shutdown") def t_shutdown(sf): diff --git a/src/webapp.py b/src/webapp.py index de7cec9..47a2336 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -455,7 +455,8 @@ class ScriptFormWebApp(WebAppHandler): # Log the callback and its parameters for auditing purposes. log = logging.getLogger('CALLBACK_AUDIT') - log.info("Calling script {0}".format(form_def.script)) + log.info("Calling script: {0}".format(form_def.script)) + log.info("Current working dir: {0}".format(os.path.realpath(os.curdir))) log.info("User: {0}".format(getattr(self.request, 'username', 'None'))) log.info("Variables: {0}".format(dict(form_values.items())))