22 > |
22 > |
23 > errors = StringIO() |
23 > errors = StringIO() |
24 > input = StringIO() |
24 > input = StringIO() |
25 > |
25 > |
26 > def startrsp(status, headers): |
26 > def startrsp(status, headers): |
27 > print '---- STATUS' |
27 > print '---- STATUS' |
28 > print status |
28 > print status |
29 > print '---- HEADERS' |
29 > print '---- HEADERS' |
30 > print [i for i in headers if i[0] != 'ETag'] |
30 > print [i for i in headers if i[0] != 'ETag'] |
31 > print '---- DATA' |
31 > print '---- DATA' |
32 > return output.write |
32 > return output.write |
33 > |
33 > |
34 > env = { |
34 > env = { |
35 > 'wsgi.version': (1, 0), |
35 > 'wsgi.version': (1, 0), |
36 > 'wsgi.url_scheme': 'http', |
36 > 'wsgi.url_scheme': 'http', |
37 > 'wsgi.errors': errors, |
37 > 'wsgi.errors': errors, |
38 > 'wsgi.input': input, |
38 > 'wsgi.input': input, |
39 > 'wsgi.multithread': False, |
39 > 'wsgi.multithread': False, |
40 > 'wsgi.multiprocess': False, |
40 > 'wsgi.multiprocess': False, |
41 > 'wsgi.run_once': False, |
41 > 'wsgi.run_once': False, |
42 > 'REQUEST_METHOD': 'GET', |
42 > 'REQUEST_METHOD': 'GET', |
43 > 'SCRIPT_NAME': '', |
43 > 'SCRIPT_NAME': '', |
44 > 'SERVER_NAME': '127.0.0.1', |
44 > 'SERVER_NAME': '127.0.0.1', |
45 > 'SERVER_PORT': os.environ['HGPORT'], |
45 > 'SERVER_PORT': os.environ['HGPORT'], |
46 > 'SERVER_PROTOCOL': 'HTTP/1.0' |
46 > 'SERVER_PROTOCOL': 'HTTP/1.0' |
47 > } |
47 > } |
48 > |
48 > |
49 > def process(app): |
49 > def process(app): |
50 > content = app(env, startrsp) |
50 > content = app(env, startrsp) |
51 > sys.stdout.write(output.getvalue()) |
51 > sys.stdout.write(output.getvalue()) |
52 > sys.stdout.write(''.join(content)) |
52 > sys.stdout.write(''.join(content)) |
53 > print '---- ERRORS' |
53 > print '---- ERRORS' |
54 > print errors.getvalue() |
54 > print errors.getvalue() |
55 > |
|
56 > |
55 > |
57 > output = StringIO() |
56 > output = StringIO() |
58 > env['PATH_INFO'] = '/' |
57 > env['PATH_INFO'] = '/' |
59 > env['QUERY_STRING'] = 'style=atom' |
58 > env['QUERY_STRING'] = 'style=atom' |
60 > process(hgweb('.', name = 'repo')) |
59 > process(hgweb('.', name = 'repo')) |