Code quality improvements.

pull/7/head 1.1
Ferry Boender 7 years ago
parent 3ce2ad0642
commit aec8cb860e
  1. 2
      src/daemon.py
  2. 5
      src/scriptform.py
  3. 3
      src/webapp.py

@ -163,7 +163,7 @@ class Daemon(object): # pragma: no cover
def _cleanup(self, sig=None, frame=None): def _cleanup(self, sig=None, frame=None):
""" """
Remvoe pid files and call registered shutodnw callbacks. Remove pid files and call registered shutodnw callbacks.
""" """
self.log.info("Received signal %s", sig) self.log.info("Received signal %s", sig)
if os.path.exists(self.pid_file): if os.path.exists(self.pid_file):

@ -87,8 +87,9 @@ class ScriptForm(object):
file_contents = file(self.config_file, 'r').read() file_contents = file(self.config_file, 'r').read()
try: try:
config = json.loads(file_contents) config = json.loads(file_contents)
except ValueError as e: except ValueError as err:
sys.stderr.write("Error in form configuration '{}': {}\n".format(self.config_file, e)) sys.stderr.write("Error in form configuration '{}': {}\n".format(
self.config_file, err))
sys.exit(1) sys.exit(1)
static_dir = None static_dir = None

@ -195,7 +195,8 @@ class ScriptFormWebApp(RequestHandler):
if auth_header is not None: if auth_header is not None:
# Validate the username and password # Validate the username and password
auth_unpw = auth_header.split(' ', 1)[1] auth_unpw = auth_header.split(' ', 1)[1]
username, password = base64.decodestring(auth_unpw).split(":", 1) username, password = base64.decodestring(auth_unpw).split(":",
1)
pw_hash = hashlib.sha256(password).hexdigest() pw_hash = hashlib.sha256(password).hexdigest()
if username in form_config.users and \ if username in form_config.users and \

Loading…
Cancel
Save