Show More
@@ -17,20 +17,6 b' class wsgiapplication(object):' | |||
|
17 | 17 | def __call__(self, wsgienv, start_response): |
|
18 | 18 | return _wsgirequest(self.destmaker(), wsgienv, start_response) |
|
19 | 19 | |
|
20 | class _wsgioutputfile(object): | |
|
21 | def __init__(self, request): | |
|
22 | self.request = request | |
|
23 | ||
|
24 | def write(self, data): | |
|
25 | self.request.write(data) | |
|
26 | def writelines(self, lines): | |
|
27 | for line in lines: | |
|
28 | self.write(line) | |
|
29 | def flush(self): | |
|
30 | return None | |
|
31 | def close(self): | |
|
32 | return None | |
|
33 | ||
|
34 | 20 | class _wsgirequest(object): |
|
35 | 21 | def __init__(self, destination, wsgienv, start_response): |
|
36 | 22 | version = wsgienv['wsgi.version'] |
@@ -38,7 +24,6 b' class _wsgirequest(object):' | |||
|
38 | 24 | raise RuntimeError("Unknown and unsupported WSGI version %d.%d" \ |
|
39 | 25 | % version) |
|
40 | 26 | self.inp = wsgienv['wsgi.input'] |
|
41 | self.out = _wsgioutputfile(self) | |
|
42 | 27 | self.server_write = None |
|
43 | 28 | self.err = wsgienv['wsgi.errors'] |
|
44 | 29 | self.threaded = wsgienv['wsgi.multithread'] |
@@ -50,6 +35,8 b' class _wsgirequest(object):' | |||
|
50 | 35 | self.headers = [] |
|
51 | 36 | destination.run_wsgi(self) |
|
52 | 37 | |
|
38 | out = property(lambda self: self) | |
|
39 | ||
|
53 | 40 | def __iter__(self): |
|
54 | 41 | return iter([]) |
|
55 | 42 | |
@@ -76,6 +63,16 b' class _wsgirequest(object):' | |||
|
76 | 63 | if inst[0] != errno.ECONNRESET: |
|
77 | 64 | raise |
|
78 | 65 | |
|
66 | def writelines(self, lines): | |
|
67 | for line in lines: | |
|
68 | self.write(line) | |
|
69 | ||
|
70 | def flush(self): | |
|
71 | return None | |
|
72 | ||
|
73 | def close(self): | |
|
74 | return None | |
|
75 | ||
|
79 | 76 | def header(self, headers=[('Content-type','text/html')]): |
|
80 | 77 | self.headers.extend(headers) |
|
81 | 78 |
General Comments 0
You need to be logged in to leave comments.
Login now