From dcf0a11bc3059b892410cc8b8c7e752598f6f2e7 Mon Sep 17 00:00:00 2001 From: Sergey Shepelev Date: Thu, 8 Aug 2013 19:52:41 +0400 Subject: [PATCH] wsgi: pep8 whitespace --- eventlet/wsgi.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eventlet/wsgi.py b/eventlet/wsgi.py index 0ed4d12..59186e5 100644 --- a/eventlet/wsgi.py +++ b/eventlet/wsgi.py @@ -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.