changeset 5583:ea0b35b54bbf

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 25 Feb 2010 01:35:51 +0100
parents ca98db50efac (diff) 803f1463fb5c (current diff)
children dc574a6d2516
files
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Wed Feb 24 00:15:27 2010 +0100
+++ b/MoinMoin/web/contexts.py	Thu Feb 25 01:35:51 2010 +0100
@@ -281,7 +281,7 @@
     # the output related methods
     def write(self, *data):
         """ Write to output stream. """
-        self.request.stream.writelines(data)
+        self.request.out_stream.writelines(data)
 
     def redirectedOutput(self, function, *args, **kw):
         """ Redirect output during function, return redirected output """
--- a/MoinMoin/web/request.py	Wed Feb 24 00:15:27 2010 +0100
+++ b/MoinMoin/web/request.py	Thu Feb 25 01:35:51 2010 +0100
@@ -47,7 +47,24 @@
         self.response = []
         self.status_code = 200
 
-    in_stream = RequestBase.stream
+    # XXX ugly hack begin - works by sheer luck
+    # TODO keep request and response separate, don't mix them together
+    stream = property() # protect inherited .stream attr from accessing
+    
+    try:
+        # for werkzeug 0.6
+        in_stream = cached_property(RequestBase.stream.func, 'in_stream')
+    except AttributeError:
+        # no .func -> werkzeug 0.5
+        in_stream = RequestBase.stream
+
+    try:
+        # for werkzeug 0.6
+        out_stream = cached_property(ResponseBase.stream.func, 'out_stream')
+    except AttributeError:
+        # no .func -> werkzeug 0.5
+        out_stream = ResponseBase.stream
+    # XXX ugly hack end
 
     @cached_property
     def in_data(self):