wsgi: pep8 whitespace

This commit is contained in:
Sergey Shepelev
2013-08-08 19:52:41 +04:00
parent 30fd49f44b
commit dcf0a11bc3

View File

@@ -31,6 +31,7 @@ _monthname = [None, # Dummy so we can use 1-based month numbers
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
def format_date_time(timestamp):
"""Formats a unix timestamp into an HTTP standard string."""
year, month, day, hh, mm, ss, wd, _y, _z = time.gmtime(timestamp)
@@ -38,11 +39,13 @@ def format_date_time(timestamp):
_weekdayname[wd], day, _monthname[month], year, hh, mm, ss
)
# Collections of error codes to compare against. Not all attributes are set
# on errno module on all platforms, so some are literals :(
BAD_SOCK = set((errno.EBADF, 10053))
BROKEN_SOCK = set((errno.EPIPE, errno.ECONNRESET))
# special flag return value for apps
class _AlreadyHandled(object):
@@ -54,7 +57,9 @@ class _AlreadyHandled(object):
ALREADY_HANDLED = _AlreadyHandled()
class Input(object):
def __init__(self,
rfile,
content_length,
@@ -519,8 +524,8 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
self.connection.close()
class Server(BaseHTTPServer.HTTPServer):
def __init__(self,
socket,
address,
@@ -593,6 +598,7 @@ class Server(BaseHTTPServer.HTTPServer):
def log_message(self, message):
self.log.write(message + '\n')
try:
import ssl
ACCEPT_EXCEPTIONS = (socket.error, ssl.SSLError)
@@ -602,6 +608,7 @@ except ImportError:
ACCEPT_EXCEPTIONS = (socket.error,)
ACCEPT_ERRNO = set((errno.EPIPE, errno.EBADF, errno.ECONNRESET))
def server(sock, site,
log=None,
environ=None,
@@ -617,7 +624,7 @@ def server(sock, site,
log_format=DEFAULT_LOG_FORMAT,
url_length_limit=MAX_REQUEST_LINE,
debug=True):
""" Start up a wsgi server handling requests from the supplied server
"""Start up a WSGI server handling requests from the supplied server
socket. This function loops forever. The *sock* object will be closed after server exits,
but the underlying file descriptor will remain open, so if you have a dup() of *sock*,
it will remain usable.