diff MoinMoin/web/request.py @ 5582:ca98db50efac

request: fix for werkzeug 0.6 and 0.5.1 compatibility
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 25 Feb 2010 01:35:06 +0100
parents 3a79d3ca5a83
children a8199daaf217
line wrap: on
line diff
--- a/MoinMoin/web/request.py	Tue Feb 23 23:45:09 2010 +0100
+++ b/MoinMoin/web/request.py	Thu Feb 25 01:35:06 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):