Author: russellm
Date: 2010-11-04 07:03:38 -0500 (Thu, 04 Nov 2010)
New Revision: 14453

Modified:
   django/trunk/django/core/handlers/wsgi.py
Log:
Fixed #14602 -- Added an extra check to wsgi.input handling to prevent 
AppEngine from choking. Thanks to Waldemar Kornewald for the report.

Modified: django/trunk/django/core/handlers/wsgi.py
===================================================================
--- django/trunk/django/core/handlers/wsgi.py   2010-11-04 12:03:01 UTC (rev 
14452)
+++ django/trunk/django/core/handlers/wsgi.py   2010-11-04 12:03:38 UTC (rev 
14453)
@@ -134,7 +134,7 @@
         self.META['SCRIPT_NAME'] = script_name
         self.method = environ['REQUEST_METHOD'].upper()
         self._post_parse_error = False
-        if isinstance(self.environ['wsgi.input'], socket._fileobject):
+        if type(socket._fileobject) is type and 
isinstance(self.environ['wsgi.input'], socket._fileobject):
             # Under development server 'wsgi.input' is an instance of
             # socket._fileobject which hangs indefinitely on reading bytes past
             # available count. To prevent this it's wrapped in LimitedStream
@@ -144,6 +144,9 @@
             # streams) beacuse they don't suffer from this problem and we can
             # avoid using another wrapper with its own .read and .readline
             # implementation.
+            #
+            # The type check is done because for some reason, AppEngine
+            # implements _fileobject as a function, not a class.
             try:
                 content_length = int(self.environ.get('CONTENT_LENGTH', 0))
             except (ValueError, TypeError):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to