Mercurial > moin > 1.9
changeset 3360:b5b49ff88d0c
work around unpythonic WSGI 1.0 read() API, fixing broken xmlrpc putPage with mod_wsgi
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Thu, 20 Mar 2008 18:00:37 +0100 |
parents | dd6293254e4f |
children | 8fca4e0c0de5 |
files | MoinMoin/request/request_wsgi.py |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/request/request_wsgi.py Thu Mar 20 17:40:22 2008 +0100 +++ b/MoinMoin/request/request_wsgi.py Thu Mar 20 18:00:37 2008 +0100 @@ -37,7 +37,20 @@ def read(self, n=None): if n is None: - return self.stdin.read() + # We can't do that, because wsgi 1.0 requires n: + #return self.stdin.read() + # Thus, if we have no n, we have to simulate the usual behaviour (or + # it won't work e.g. with mod_wsgi 1.3 and maybe other wsgi 1.0 servers). + # Note: just requesting a extremely large amount (expecting it to never + # be reached, but still all data returned) also does not work (mod_wsgi + # 1.3 gives a MemoryError when doing that): + data = [] + while True: + read_data = self.stdin.read(4000) + if not read_data: + break + data.append(read_data) + return ''.join(data) else: return self.stdin.read(n)