summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cherrypy/wsgiserver/wsgiserver2.py18
-rw-r--r--cherrypy/wsgiserver/wsgiserver3.py19
2 files changed, 7 insertions, 30 deletions
diff --git a/cherrypy/wsgiserver/wsgiserver2.py b/cherrypy/wsgiserver/wsgiserver2.py
index 43323901..5f5c4fb3 100644
--- a/cherrypy/wsgiserver/wsgiserver2.py
+++ b/cherrypy/wsgiserver/wsgiserver2.py
@@ -90,7 +90,6 @@ import sys
import threading
import time
import traceback as traceback_
-import operator
try:
from urllib.parse import unquote_to_bytes
except ImportError:
@@ -548,17 +547,6 @@ class ChunkedRFile(object):
def close(self):
self.rfile.close()
- def __iter__(self):
- # Shamelessly stolen from StringIO
- total = 0
- line = self.readline(sizehint)
- while line:
- yield line
- total += len(line)
- if 0 < sizehint <= total:
- break
- line = self.readline(sizehint)
-
class HTTPRequest(object):
@@ -2300,7 +2288,7 @@ class WSGIGateway(Gateway):
# exc_info tuple."
if self.req.sent_headers:
try:
- raise exc_info[0], exc_info[1], exc_info[2]
+ six.reraise(*exc_info)
finally:
exc_info = None
@@ -2465,8 +2453,8 @@ class WSGIPathInfoDispatcher(object):
pass
# Sort the apps by len(path), descending
- apps.sort(cmp=lambda x, y: cmp(len(x[0]), len(y[0])))
- apps.reverse()
+ by_path_len = lambda app: len(app[0])
+ apps.sort(key=by_path_len, reverse=True)
# The path_prefix strings must start, but not end, with a slash.
# Use "" instead of "/".
diff --git a/cherrypy/wsgiserver/wsgiserver3.py b/cherrypy/wsgiserver/wsgiserver3.py
index 46da0f37..0bf9f3b2 100644
--- a/cherrypy/wsgiserver/wsgiserver3.py
+++ b/cherrypy/wsgiserver/wsgiserver3.py
@@ -1,5 +1,5 @@
"""A high-speed, production ready, thread pooled, generic HTTP server.
-
+a
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
@@ -534,17 +534,6 @@ class ChunkedRFile(object):
def close(self):
self.rfile.close()
- def __iter__(self):
- # Shamelessly stolen from StringIO
- total = 0
- line = self.readline(sizehint)
- while line:
- yield line
- total += len(line)
- if 0 < sizehint <= total:
- break
- line = self.readline(sizehint)
-
class HTTPRequest(object):
@@ -2334,7 +2323,7 @@ class WSGIGateway(Gateway):
# exc_info tuple."
if self.req.sent_headers:
try:
- raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])
+ six.reraise(*exc_info)
finally:
exc_info = None
@@ -2503,8 +2492,8 @@ class WSGIPathInfoDispatcher(object):
pass
# Sort the apps by len(path), descending
- apps.sort()
- apps.reverse()
+ by_path_len = lambda app: len(app[0])
+ apps.sort(key=by_path_len, reverse=True)
# The path_prefix strings must start, but not end, with a slash.
# Use "" instead of "/".