summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2014-01-06 18:38:58 +0100
committerHelmut Grohne <helmut@subdivi.de>2014-01-06 18:38:58 +0100
commit42f5ccf09799d3e475eb996b023a0daabae49cdb (patch)
tree91f7407adf98014a5f5652a94ba4e1f16af3e8d2
parented6d6c8f06404489ba2301955c8e6f82f8f4f454 (diff)
downloadwsgitools-42f5ccf09799d3e475eb996b023a0daabae49cdb.tar.gz
switch to new-style classes entirely
There is no reason to use old-style classes beyond laziness.
-rwxr-xr-xtest.py6
-rw-r--r--wsgitools/adapters.py4
-rw-r--r--wsgitools/applications.py4
-rw-r--r--wsgitools/authentication.py2
-rw-r--r--wsgitools/digest.py6
-rw-r--r--wsgitools/filters.py6
-rw-r--r--wsgitools/middlewares.py12
-rw-r--r--wsgitools/scgi/__init__.py2
-rw-r--r--wsgitools/scgi/forkpool.py6
9 files changed, 24 insertions, 24 deletions
diff --git a/test.py b/test.py
index 3eb9553..5cbf842 100755
--- a/test.py
+++ b/test.py
@@ -22,7 +22,7 @@ except NameError:
def next(iterator):
return iterator.next()
-class Request:
+class Request(object):
def __init__(self, case):
"""
@type case: unittest.TestCase
@@ -88,7 +88,7 @@ class Request:
iterator.close()
return res
-class Result:
+class Result(object):
def __init__(self, case):
"""
@type case: unittest.TestCase
@@ -269,7 +269,7 @@ class NoWriteCallableMiddlewareTest(unittest.TestCase):
self.assertEqual(res.writtendata, [])
self.assertEqual("".join(res.returneddata), "firstsecond")
-class StupidIO:
+class StupidIO(object):
"""file-like without tell method, so StaticFile is not able to
determine the content-length."""
def __init__(self, content):
diff --git a/wsgitools/adapters.py b/wsgitools/adapters.py
index 6c6bbca..2c7615a 100644
--- a/wsgitools/adapters.py
+++ b/wsgitools/adapters.py
@@ -16,7 +16,7 @@ except NameError:
return it.next()
__all__.append("WSGI2to1Adapter")
-class WSGI2to1Adapter:
+class WSGI2to1Adapter(object):
"""Adapts an application with an interface that might somewhen be known as
WSGI 2.0 to the WSGI 1.0 interface."""
def __init__(self, app):
@@ -34,7 +34,7 @@ class WSGI2to1Adapter:
return iterable
__all__.append("WSGI1to2Adapter")
-class WSGI1to2Adapter:
+class WSGI1to2Adapter(object):
"""Adapts a WSGI 1.0 application to something that might somewhen be the
WSGI 2.0 interface."""
def __init__(self, app):
diff --git a/wsgitools/applications.py b/wsgitools/applications.py
index 8a02fe8..6b6601b 100644
--- a/wsgitools/applications.py
+++ b/wsgitools/applications.py
@@ -8,7 +8,7 @@ except NameError:
basestring = str
__all__.append("StaticContent")
-class StaticContent:
+class StaticContent(object):
"""
This wsgi application provides static content on whatever request it
receives with method GET or HEAD (content stripped). If not present, a
@@ -60,7 +60,7 @@ class StaticContent:
return self.content
__all__.append("StaticFile")
-class StaticFile:
+class StaticFile(object):
"""
This wsgi application provides the content of a static file on whatever
request it receives with method GET or HEAD (content stripped). If not
diff --git a/wsgitools/authentication.py b/wsgitools/authentication.py
index 6f5d07b..c39c018 100644
--- a/wsgitools/authentication.py
+++ b/wsgitools/authentication.py
@@ -9,7 +9,7 @@ class AuthenticationRequired(Exception):
class ProtocolViolation(AuthenticationRequired):
pass
-class AuthenticationMiddleware:
+class AuthenticationMiddleware(object):
"""Base class for HTTP authorization schemes.
@cvar authorization_method: the implemented Authorization method. It will
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index 085047f..5ed05f8 100644
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -133,7 +133,7 @@ class StaleNonce(AuthenticationRequired):
pass
__all__.append("AbstractTokenGenerator")
-class AbstractTokenGenerator:
+class AbstractTokenGenerator(object):
"""Interface class for generating authentication tokens for
L{AuthDigestMiddleware}.
@@ -281,7 +281,7 @@ class UpdatingHtdigestTokenGenerator(HtdigestTokenGenerator):
return HtdigestTokenGenerator.__call__(self, user, algo)
__all__.append("NonceStoreBase")
-class NonceStoreBase:
+class NonceStoreBase(object):
"""Nonce storage interface."""
def __init__(self):
pass
@@ -497,7 +497,7 @@ class MemoryNonceStore(NonceStoreBase):
return True
__all__.append("LazyDBAPI2Opener")
-class LazyDBAPI2Opener:
+class LazyDBAPI2Opener(object):
"""
Connects to database on first request. Otherwise it behaves like a dbapi2
connection. This may be usefull in combination with L{scgi.forkpool},
diff --git a/wsgitools/filters.py b/wsgitools/filters.py
index 7ae1b69..d691f74 100644
--- a/wsgitools/filters.py
+++ b/wsgitools/filters.py
@@ -24,7 +24,7 @@ except NameError:
return it.next()
__all__.append("CloseableIterator")
-class CloseableIterator:
+class CloseableIterator(object):
"""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
@@ -68,7 +68,7 @@ class CloseableList(list):
list.__iter__(self))
__all__.append("BaseWSGIFilter")
-class BaseWSGIFilter:
+class BaseWSGIFilter(object):
"""Generic WSGI filter class to be used with L{WSGIFilterMiddleware}.
For each request a filter object gets created.
@@ -147,7 +147,7 @@ class BaseWSGIFilter:
pass
__all__.append("WSGIFilterMiddleware")
-class WSGIFilterMiddleware:
+class WSGIFilterMiddleware(object):
"""This wsgi middleware can be used with specialized L{BaseWSGIFilter}s to
modify wsgi requests and/or reponses."""
def __init__(self, app, filterclass):
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index 804d474..0f5e416 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -29,7 +29,7 @@ from wsgitools.authentication import AuthenticationRequired, \
ProtocolViolation, AuthenticationMiddleware
__all__.append("SubdirMiddleware")
-class SubdirMiddleware:
+class SubdirMiddleware(object):
"""Middleware choosing wsgi applications based on a dict."""
def __init__(self, default, mapping={}):
"""
@@ -62,7 +62,7 @@ class SubdirMiddleware:
return app(environ, start_response)
__all__.append("NoWriteCallableMiddleware")
-class NoWriteCallableMiddleware:
+class NoWriteCallableMiddleware(object):
"""This middleware wraps a wsgi application that needs the return value of
C{start_response} function to a wsgi application that doesn't need one by
writing the data to a C{StringIO} and then making it be the first result
@@ -129,7 +129,7 @@ class NoWriteCallableMiddleware:
(data,), ret)
__all__.append("ContentLengthMiddleware")
-class ContentLengthMiddleware:
+class ContentLengthMiddleware(object):
"""Guesses the content length header if possible.
@note: The application used must not use the C{write} callable returned by
C{start_response}."""
@@ -221,7 +221,7 @@ def cacheable(environ):
return True
__all__.append("CachingMiddleware")
-class CachingMiddleware:
+class CachingMiddleware(object):
"""Caches reponses to requests based on C{SCRIPT_NAME}, C{PATH_INFO} and
C{QUERY_STRING}."""
def __init__(self, app, maxage=60, storable=storable, cacheable=cacheable):
@@ -316,7 +316,7 @@ class CachingMiddleware:
return CloseableIterator(getattr(ret, "close", None), pass_through())
__all__.append("DictAuthChecker")
-class DictAuthChecker:
+class DictAuthChecker(object):
"""Verifies usernames and passwords by looking them up in a dict."""
def __init__(self, users):
"""
@@ -387,7 +387,7 @@ class BasicAuthMiddleware(AuthenticationMiddleware):
self, environ, start_response, exception)
__all__.append("TracebackMiddleware")
-class TracebackMiddleware:
+class TracebackMiddleware(object):
"""In case the application throws an exception this middleware will show an
html-formatted traceback using C{cgitb}."""
def __init__(self, app):
diff --git a/wsgitools/scgi/__init__.py b/wsgitools/scgi/__init__.py
index cbe7a80..898fd61 100644
--- a/wsgitools/scgi/__init__.py
+++ b/wsgitools/scgi/__init__.py
@@ -7,7 +7,7 @@ except ImportError:
else:
have_sendfile = True
-class FileWrapper:
+class FileWrapper(object):
"""
@ivar offset: Initially 0. Becomes -1 when reading using next and
becomes positive when reading using next. In the latter case it
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py
index 514094f..a49d1ec 100644
--- a/wsgitools/scgi/forkpool.py
+++ b/wsgitools/scgi/forkpool.py
@@ -27,7 +27,7 @@ else:
__all__ = []
-class SocketFileWrapper:
+class SocketFileWrapper(object):
"""Wraps a socket to a wsgi-compliant file-like object."""
def __init__(self, sock, toread):
"""@param sock: is a C{socket.socket()}"""
@@ -165,10 +165,10 @@ class SocketFileWrapper:
self.write(line)
__all__.append("SCGIServer")
-class SCGIServer:
+class SCGIServer(object):
"""Usage: create an L{SCGIServer} object and invoke the run method which
will then turn this process into an scgi server."""
- class WorkerState:
+ class WorkerState(object):
"""state: 0 means idle and 1 means working.
These values are also sent as strings '0' and '1' over the socket."""
def __init__(self, pid, sock, state):