Cosmetics

This commit is contained in:
Guillaume Ayoub 2016-08-02 14:37:39 +02:00
parent d322d3f394
commit 301bb552d7

View File

@ -26,16 +26,16 @@ should have been included in this package.
""" """
import os
import pprint
import base64 import base64
import contextlib import contextlib
import os
import pprint
import shlex import shlex
import socket import socket
import socketserver import socketserver
import ssl import ssl
import threading
import subprocess import subprocess
import threading
import wsgiref.simple_server import wsgiref.simple_server
import zlib import zlib
from http import client from http import client
@ -244,8 +244,8 @@ class Application:
"""Manage a request.""" """Manage a request."""
def response(status, headers={}, answer=None): def response(status, headers={}, answer=None):
# Start response # Start response
status = "%i %s" % (status, status = "%i %s" % (
client.responses.get(status, "Unknown")) status, client.responses.get(status, "Unknown"))
self.logger.debug("Answer status: %s" % status) self.logger.debug("Answer status: %s" % status)
start_response(status, list(headers.items())) start_response(status, list(headers.items()))
# Return response content # Return response content
@ -354,8 +354,8 @@ class Application:
if lock_mode == "w" and hook: if lock_mode == "w" and hook:
self.logger.debug("Running hook") self.logger.debug("Running hook")
folder = os.path.expanduser( folder = os.path.expanduser(
self.configuration.get("storage", self.configuration.get(
"filesystem_folder")) "storage", "filesystem_folder"))
subprocess.check_call( subprocess.check_call(
hook % {"user": shlex.quote(user or "Anonymous")}, hook % {"user": shlex.quote(user or "Anonymous")},
shell=True, cwd=folder) shell=True, cwd=folder)