summaryrefslogtreecommitdiff
path: root/wsgitools/applications.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2012-06-28 22:38:28 +0200
committerHelmut Grohne <helmut@subdivi.de>2012-06-28 22:38:28 +0200
commit7e2e9173b2afcc2a8dca9e6047d0b82ad70c9dff (patch)
treea44f625d4621348ae14a63f72aad1594cd794ed8 /wsgitools/applications.py
parentb83f5682c9d81cd53b8b45a6baedc844a68b85d2 (diff)
downloadwsgitools-7e2e9173b2afcc2a8dca9e6047d0b82ad70c9dff.tar.gz
first part of bytes conversion
Convert the request body data from str to bytes. This replaces all StringIOs with BytesIOs (removing backwards one more backwards compatibility). Also all character sequences involved in request bodies get a b"" prefix. The StaticContent application takes bytes instead of str (no difference for py2x). The GzipWSGIFilter needs a fixed as a truncate of a BytesIO does not rewind the stream position.
Diffstat (limited to 'wsgitools/applications.py')
-rw-r--r--wsgitools/applications.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/wsgitools/applications.py b/wsgitools/applications.py
index 8a02fe8..cdaf0ae 100644
--- a/wsgitools/applications.py
+++ b/wsgitools/applications.py
@@ -21,7 +21,7 @@ class StaticContent:
@type headers: list
@param headers: is a list of C{(header, value)} pairs being delivered as
HTTP headers
- @type content: basestring
+ @type content: bytes
@param content: contains the data to be delivered to the client. It is
either a string or some kind of iterable yielding strings.
@type anymethod: boolean
@@ -30,12 +30,12 @@ class StaticContent:
"""
assert isinstance(status, str)
assert isinstance(headers, list)
- assert isinstance(content, basestring) or hasattr(content, "__iter__")
+ assert isinstance(content, bytes) or hasattr(content, "__iter__")
self.status = status
self.headers = headers
self.anymethod = anymethod
length = -1
- if isinstance(content, basestring):
+ if isinstance(content, bytes):
self.content = [content]
length = len(content)
else: