Skip to content

Commit c294c42

Browse files
author
Richard Jones
committed
make WSGI threadsafe
1 parent 0386030 commit c294c42

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Fixed:
1818
- Fix indexerror when there are no messages to an issue (sf patch #1894249)
1919
- Prevent broken pipe errors in csv export (sf patch #1911449)
2020
- Session API and cleanup thanks anatoly t.
21+
- Make WSGI handler threadsafe (sf #1968027)
2122

2223

2324
2008-03-01 1.4.4

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ David Linke,
130130
Martin v. L�wis,
131131
Fredrik Lundh,
132132
Will Maier,
133+
Ksenia Marasanova,
133134
Georges Martin,
134135
Gordon McMillan,
135136
John F Meinel Jr,

roundup/cgi/wsgi_handler.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,28 @@ def __init__(self, home, debug=False, timing=False, lang=None):
3737
def __call__(self, environ, start_response):
3838
"""Initialize with `apache.Request` object"""
3939
self.environ = environ
40-
self.__start_response = start_response
40+
request = RequestDispatcher(self.home, self.debug, self.timing)
41+
request.__start_response = start_response
4142

42-
self.wfile = Writer(self)
43-
self.__wfile = None
43+
request.wfile = Writer(request)
44+
request.__wfile = None
4445

4546
tracker = roundup.instance.open(self.home, not self.debug)
4647

4748
# need to strip the leading '/'
4849
environ["PATH_INFO"] = environ["PATH_INFO"][1:]
49-
if self.timing:
50-
environ["CGI_SHOW_TIMING"] = self.timing
50+
if request.timing:
51+
environ["CGI_SHOW_TIMING"] = request.timing
5152

5253
form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)
5354

54-
client = tracker.Client(tracker, self, environ, form,
55-
self.translator)
55+
client = tracker.Client(tracker, request, environ, form,
56+
request.translator)
5657
try:
5758
client.main()
5859
except roundup.cgi.client.NotFound:
59-
self.start_response([('Content-Type', 'text/html')], 404)
60-
self.wfile.write('Not found: %s'%client.path)
60+
request.start_response([('Content-Type', 'text/html')], 404)
61+
request.wfile.write('Not found: %s'%client.path)
6162

6263
# all body data has been written using wfile
6364
return []

0 commit comments

Comments
 (0)