Mercurial > p > roundup > code
comparison roundup/cgi/wsgi_handler.py @ 6083:f74d078cfd9a
issue2551019 needs to be handled in the action code itself, not the WSGI handler
for Python 3 we always need to encode the output in the client character set
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Sat, 08 Feb 2020 00:29:13 +0000 |
| parents | 274c2c082f68 |
| children | 3cba8949bfe0 |
comparison
equal
deleted
inserted
replaced
| 6082:a3221c686736 | 6083:f74d078cfd9a |
|---|---|
| 12 from roundup.anypy.html import html_escape | 12 from roundup.anypy.html import html_escape |
| 13 | 13 |
| 14 import roundup.instance | 14 import roundup.instance |
| 15 from roundup.cgi import TranslationService | 15 from roundup.cgi import TranslationService |
| 16 from roundup.anypy import http_ | 16 from roundup.anypy import http_ |
| 17 from roundup.anypy.strings import s2b, bs2b | 17 from roundup.anypy.strings import s2b |
| 18 | 18 |
| 19 from roundup.cgi.client import BinaryFieldStorage | 19 from roundup.cgi.client import BinaryFieldStorage |
| 20 | 20 |
| 21 BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler | 21 BaseHTTPRequestHandler = http_.server.BaseHTTPRequestHandler |
| 22 DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE | 22 DEFAULT_ERROR_MESSAGE = http_.server.DEFAULT_ERROR_MESSAGE |
| 48 def __init__(self, request): | 48 def __init__(self, request): |
| 49 self.request = request #weakref.ref(request) | 49 self.request = request #weakref.ref(request) |
| 50 | 50 |
| 51 def write(self, data): | 51 def write(self, data): |
| 52 f = self.request.get_wfile() | 52 f = self.request.get_wfile() |
| 53 self.write = lambda data: f(bs2b(data)) | 53 self.write = f |
| 54 return self.write(data) | 54 return self.write(data) |
| 55 | 55 |
| 56 | 56 |
| 57 class RequestDispatcher(object): | 57 class RequestDispatcher(object): |
| 58 def __init__(self, home, debug=False, timing=False, lang=None): | 58 def __init__(self, home, debug=False, timing=False, lang=None): |
