summaryrefslogtreecommitdiff
path: root/wsgitools/filters.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-06-17 19:35:21 +0200
committerHelmut Grohne <helmut@subdivi.de>2023-06-18 22:44:01 +0200
commit4d52eaa4801df3f3169df8e58758bcccf22dc4de (patch)
treeb8740a88e380a750d9d2607bb39cbc759a8d7175 /wsgitools/filters.py
parent682ce67b73453809237532a7ce2feee07f2900d5 (diff)
downloadwsgitools-4d52eaa4801df3f3169df8e58758bcccf22dc4de.tar.gz
drop support for Python 2.x
Diffstat (limited to 'wsgitools/filters.py')
-rw-r--r--wsgitools/filters.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/wsgitools/filters.py b/wsgitools/filters.py
index 2a97066..7f8543d 100644
--- a/wsgitools/filters.py
+++ b/wsgitools/filters.py
@@ -15,7 +15,7 @@ import io
from wsgitools.internal import str2bytes
__all__.append("CloseableIterator")
-class CloseableIterator(object):
+class CloseableIterator:
"""Concatenating iterator with close attribute."""
def __init__(self, close_function, *iterators):
"""If close_function is not C{None}, it will be the C{close} attribute
@@ -40,8 +40,7 @@ class CloseableIterator(object):
except StopIteration:
self.iterators.pop(0)
return next(self)
- def next(self):
- return self.__next__()
+
__all__.append("CloseableList")
class CloseableList(list):
@@ -61,7 +60,7 @@ class CloseableList(list):
list.__iter__(self))
__all__.append("BaseWSGIFilter")
-class BaseWSGIFilter(object):
+class BaseWSGIFilter:
"""Generic WSGI filter class to be used with L{WSGIFilterMiddleware}.
For each request a filter object gets created.
@@ -138,7 +137,7 @@ class BaseWSGIFilter(object):
"""This method is invoked after the request has finished."""
__all__.append("WSGIFilterMiddleware")
-class WSGIFilterMiddleware(object):
+class WSGIFilterMiddleware:
"""This wsgi middleware can be used with specialized L{BaseWSGIFilter}s to
modify wsgi requests and/or reponses."""
def __init__(self, app, filterclass):
@@ -322,7 +321,7 @@ class TimerWSGIFilter(BaseWSGIFilter):
@rtype: bytes
"""
if data == self.pattern:
- return str2bytes("%8.3g" % (time.time() - self.start))
+ return b"%8.3g" % (time.time() - self.start)
return data
__all__.append("EncodeWSGIFilter")