annotate MoinMoin/web/request.py @ 5582:ca98db50efac

request: fix for werkzeug 0.6 and 0.5.1 compatibility
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 25 Feb 2010 01:35:06 +0100
parents 3a79d3ca5a83
children a8199daaf217
rev   line source
4134
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
2 """
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
3 MoinMoin - New slimmed down WSGI Request.
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
4
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
5 @copyright: 2008-2008 MoinMoin:FlorianKrupicka
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
7 """
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
8
4138
6bbc4beed793 Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4134
diff changeset
9 import re
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
10 from StringIO import StringIO
4138
6bbc4beed793 Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4134
diff changeset
11
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
12 from werkzeug import Request as RequestBase
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
13 from werkzeug import Response as ResponseBase
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
14 from werkzeug import EnvironHeaders, Headers, HeaderSet
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
15 from werkzeug import Href, create_environ, url_encode, cached_property
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
16 from werkzeug import Client # used by tests
4134
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
17
4138
6bbc4beed793 Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4134
diff changeset
18 from MoinMoin import config
4134
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
19
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
20 from MoinMoin import log
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
21 logging = log.getLogger(__name__)
719256a8db51 Initial code to track down the use of request objects in MoinMoin
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
22
4250
43da090ab838 Fixed exception-handling for MoinMoinFinish and relocated it to MoinMoin.web.request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4231
diff changeset
23 class MoinMoinFinish(Exception):
43da090ab838 Fixed exception-handling for MoinMoinFinish and relocated it to MoinMoin.web.request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4231
diff changeset
24 """ Raised to jump directly to end of run() function, where finish is called """
43da090ab838 Fixed exception-handling for MoinMoinFinish and relocated it to MoinMoin.web.request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4231
diff changeset
25
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
26 class Request(ResponseBase, RequestBase):
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
27 """ A full featured Request/Response object.
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
28
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
29 To better distinguish incoming and outgoing data/headers,
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
30 incoming versions are prefixed with 'in_' in contrast to
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
31 original Werkzeug implementation.
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
32 """
4138
6bbc4beed793 Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4134
diff changeset
33 charset = config.charset
6bbc4beed793 Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4134
diff changeset
34 encoding_errors = 'replace'
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
35 default_mimetype = 'text/html'
4327
62177a952833 merged moin/1.8 repo (tests need more fixing)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4325
diff changeset
36 given_config = None # if None, load wiki config from disk
4143
917970e17b73 Added response object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4138
diff changeset
37
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
38 # get rid of some inherited descriptors
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
39 headers = None
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
40
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
41 def __init__(self, environ, populate_request=True, shallow=False):
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
42 ResponseBase.__init__(self)
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
43 RequestBase.__init__(self, environ, populate_request, shallow)
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
44 self.href = Href(self.script_root or '/', self.charset)
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
45 self.abs_href = Href(self.url_root, self.charset)
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
46 self.headers = Headers([('Content-Type', 'text/html')])
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
47 self.response = []
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
48 self.status_code = 200
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
49
5582
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
50 # XXX ugly hack begin - works by sheer luck
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
51 # TODO keep request and response separate, don't mix them together
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
52 stream = property() # protect inherited .stream attr from accessing
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
53
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
54 try:
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
55 # for werkzeug 0.6
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
56 in_stream = cached_property(RequestBase.stream.func, 'in_stream')
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
57 except AttributeError:
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
58 # no .func -> werkzeug 0.5
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
59 in_stream = RequestBase.stream
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
60
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
61 try:
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
62 # for werkzeug 0.6
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
63 out_stream = cached_property(ResponseBase.stream.func, 'out_stream')
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
64 except AttributeError:
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
65 # no .func -> werkzeug 0.5
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
66 out_stream = ResponseBase.stream
ca98db50efac request: fix for werkzeug 0.6 and 0.5.1 compatibility
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4608
diff changeset
67 # XXX ugly hack end
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
68
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
69 @cached_property
4179
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
70 def in_data(self):
00a4837da41a Consolidate Request and Response into single object
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4143
diff changeset
71 return self.in_stream.read()
4608
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
72
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
73 @cached_property
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
74 def in_headers(self):
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
75 return EnvironHeaders(self.environ)
3a79d3ca5a83 changed code to support werkzeug 0.5 (thanks to mitsuhiko for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4607
diff changeset
76
4196
42660b499488 Replace conftest-Request with new WSGI-based request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4179
diff changeset
77
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
78 class TestRequest(Request):
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
79 """ Request with customized `environ` for test purposes. """
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
80 def __init__(self, path="/", query_string=None, method='GET',
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
81 content_type=None, content_length=0, form_data=None,
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
82 environ_overrides=None):
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
83 """
4607
d8e5e9cfadf1 always do 'from werkzeug import ...', except for contrib, exceptions, routing, script
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4327
diff changeset
84 For parameter reference see the documentation of the werkzeug
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
85 package, especially the functions `url_encode` and `create_environ`.
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
86 """
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
87 input_stream = None
4198
988b2b672219 Fix tests: source code (indentation, whitespace) mostly
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4196
diff changeset
88
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
89 if form_data is not None:
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
90 form_data = url_encode(form_data)
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
91 content_type = 'application/x-www-form-urlencoded'
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
92 content_length = len(form_data)
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
93 input_stream = StringIO(form_data)
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
94 environ = create_environ(path=path, query_string=query_string,
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
95 method=method, input_stream=input_stream,
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
96 content_type=content_type,
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
97 content_length=content_length)
4203
f4a92d2ee616 Missing in_-prefix for cache-controls and more customization for TestRequest
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4202
diff changeset
98
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
99 environ['HTTP_USER_AGENT'] = 'MoinMoin/TestRequest'
4325
b6b6979b4813 fix test slowness due to failing reverse DNS lookups
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4321
diff changeset
100 # must have reverse lookup or tests will be extremely slow:
b6b6979b4813 fix test slowness due to failing reverse DNS lookups
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4321
diff changeset
101 environ['REMOTE_ADDR'] = '127.0.0.1'
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
102
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
103 if environ_overrides:
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
104 environ.update(environ_overrides)
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
105
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
106 super(TestRequest, self).__init__(environ)
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
107
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
108 def evaluate_request(request):
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
109 """ Evaluate a request and returns a tuple of application iterator,
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
110 status code and list of headers. This method is meant for testing
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
111 purposes.
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
112 """
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
113 output = []
4310
748d0cbcbd9b Fix: variable assignment in evaluate_request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4306
diff changeset
114 headers_set = []
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
115 def start_response(status, headers, exc_info=None):
4310
748d0cbcbd9b Fix: variable assignment in evaluate_request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4306
diff changeset
116 headers_set[:] = [status, headers]
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
117 return output.append
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
118 result = request(request.environ, start_response)
4202
7e43fdd2d2c0 TestRequest for use in unittests
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4198
diff changeset
119
4218
10fe93273b09 Slim down TestRequest - use evaluate_request to get an (appiter, status, headers)-tuple
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4215
diff changeset
120 # any output via (WSGI-deprecated) write-callable?
4306
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
121 if output:
d289ebf95f8f Code review: added doc strings, clarified code
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4254
diff changeset
122 result = output
4310
748d0cbcbd9b Fix: variable assignment in evaluate_request
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4306
diff changeset
123 return (result, headers_set[0], headers_set[1])