Absolute paths to scripts to easy debugging and some additional debugging messages.

pull/7/head
Ferry Boender 10 years ago
parent eca758dff3
commit 0aee57fdf4
  1. 12
      src/scriptform.py
  2. 3
      src/webapp.py

@ -86,7 +86,13 @@ class ScriptForm:
users = config['users'] users = config['users']
for form in config['forms']: for form in config['forms']:
form_name = form['name'] 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( forms.append(
FormDefinition(form_name, FormDefinition(form_name,
form['title'], form['title'],
@ -124,6 +130,10 @@ class ScriptForm:
self.running = False self.running = False
def shutdown(self): 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") self.log.info("Attempting server shutdown")
def t_shutdown(sf): def t_shutdown(sf):

@ -455,7 +455,8 @@ class ScriptFormWebApp(WebAppHandler):
# Log the callback and its parameters for auditing purposes. # Log the callback and its parameters for auditing purposes.
log = logging.getLogger('CALLBACK_AUDIT') 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("User: {0}".format(getattr(self.request, 'username', 'None')))
log.info("Variables: {0}".format(dict(form_values.items()))) log.info("Variables: {0}".format(dict(form_values.items())))

Loading…
Cancel
Save