Show More
@@ -17,20 +17,6 b' class wsgiapplication(object):' | |||||
17 | def __call__(self, wsgienv, start_response): |
|
17 | def __call__(self, wsgienv, start_response): | |
18 | return _wsgirequest(self.destmaker(), wsgienv, start_response) |
|
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 | class _wsgirequest(object): |
|
20 | class _wsgirequest(object): | |
35 | def __init__(self, destination, wsgienv, start_response): |
|
21 | def __init__(self, destination, wsgienv, start_response): | |
36 | version = wsgienv['wsgi.version'] |
|
22 | version = wsgienv['wsgi.version'] | |
@@ -38,7 +24,6 b' class _wsgirequest(object):' | |||||
38 | raise RuntimeError("Unknown and unsupported WSGI version %d.%d" \ |
|
24 | raise RuntimeError("Unknown and unsupported WSGI version %d.%d" \ | |
39 | % version) |
|
25 | % version) | |
40 | self.inp = wsgienv['wsgi.input'] |
|
26 | self.inp = wsgienv['wsgi.input'] | |
41 | self.out = _wsgioutputfile(self) |
|
|||
42 | self.server_write = None |
|
27 | self.server_write = None | |
43 | self.err = wsgienv['wsgi.errors'] |
|
28 | self.err = wsgienv['wsgi.errors'] | |
44 | self.threaded = wsgienv['wsgi.multithread'] |
|
29 | self.threaded = wsgienv['wsgi.multithread'] | |
@@ -50,6 +35,8 b' class _wsgirequest(object):' | |||||
50 | self.headers = [] |
|
35 | self.headers = [] | |
51 | destination.run_wsgi(self) |
|
36 | destination.run_wsgi(self) | |
52 |
|
37 | |||
|
38 | out = property(lambda self: self) | |||
|
39 | ||||
53 | def __iter__(self): |
|
40 | def __iter__(self): | |
54 | return iter([]) |
|
41 | return iter([]) | |
55 |
|
42 | |||
@@ -76,6 +63,16 b' class _wsgirequest(object):' | |||||
76 | if inst[0] != errno.ECONNRESET: |
|
63 | if inst[0] != errno.ECONNRESET: | |
77 | raise |
|
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 | def header(self, headers=[('Content-type','text/html')]): |
|
76 | def header(self, headers=[('Content-type','text/html')]): | |
80 | self.headers.extend(headers) |
|
77 | self.headers.extend(headers) | |
81 |
|
78 |
General Comments 0
You need to be logged in to leave comments.
Login now