diff MoinMoin/request/request_modpython.py @ 3412:91d38a790d8e

request framework: handle connection aborts gracefully
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sat, 22 Mar 2008 13:54:55 +0100
parents 799875c9fe2d
children 6fe1ea4d9d1a
line wrap: on
line diff
--- a/MoinMoin/request/request_modpython.py	Sat Mar 22 13:49:57 2008 +0100
+++ b/MoinMoin/request/request_modpython.py	Sat Mar 22 13:54:55 2008 +0100
@@ -7,7 +7,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 from MoinMoin import wikiutil
-from MoinMoin.request import RequestBase
+from MoinMoin.request import RequestBase, RemoteClosedConnection
 
 class Request(RequestBase):
     """ specialized on mod_python requests """
@@ -125,7 +125,11 @@
 
     def write(self, *data):
         """ Write to output stream. """
-        self.mpyreq.write(self.encode(data))
+        data = self.encode(data)
+        try:
+            self.mpyreq.write(data)
+        except Exception:
+            raise RemoteClosedConnection()
 
     def flush(self):
         """ We can't flush it, so do nothing. """