1. Mariano Mara
  2. WebObTestCoverage


Mariano Mara  committed 0394201 Merge

Merging latest changes from official repo

  • Participants
  • Parent commits bcd9eaa, f6edd94
  • Branches default

Comments (0)

Files changed (4)

File docs/index.txt

View file
  • Ignore whitespace
 .. comment:
     >>> from dtopt import ELLIPSIS
 Status & License
 <http://pythonpaste.org/>`_.  It is under active development.
 Discussion should happen on the `Paste mailing lists
 <http://pythonpaste.org/community/>`_, and bugs can go on the `Paste
-trac instance <http://trac.pythonpaste.org/>`_.
+trac instance <http://trac.pythonpaste.org/>`_.  It was originally
+written by Ian Bicking, and the primary maintainer is now Sergey
 WebOb is released under an `MIT-style license <license.html>`_.
     A `dictionary-like object`_ with all the variables in the request
     body.  This only has variables if the request was a ``POST`` and
-    it is a form submission.  
+    it is a form submission.
     A `dictionary-like object`_ with a combination of everything in
 Instantiating the Response
-Of course most of the time you just want to *make* a response.  
+Of course most of the time you just want to *make* a response.
 Generally any attribute of the response can be passed in as a keyword
 argument to the class; e.g.:
 <comment-example.html>`_ shows middleware.  For applications it's more
 reasonable to use WebOb in the context of a larger framework.  `Pylons
 <http://pylonshq.com>`_ uses WebOb in 0.9.7+.

File setup.py

View file
  • Ignore whitespace
     keywords='wsgi request web http',
     author='Ian Bicking',
+    maintainer='Sergey Schetinin',
+    maintainer_email='sergey@maluke.com',

File tests/test_request.py

View file
  • Ignore whitespace
     assert req.body_file is old_body_file
 class UnseekableInputWithSeek(UnseekableInput):
-    def seek(self, pos):
+    def seek(self, pos, rel=0):
         raise IOError("Invalid seek!")
 def test_broken_seek():

File webob/request.py

View file
  • Ignore whitespace
         clen = self.content_length
         if clen is None:
             clen = -1
-        r = self.body_file.read(clen)
-        self.body_file.seek(0)
+        f = self.environ['wsgi.input']
+        r = f.read(clen)
+        f.seek(0)
         return r
     def _body__set(self, value):
         This only does a shallow copy, except of wsgi.input
+        self.make_body_seekable()
         env = self.environ.copy()
         new_req = self.__class__(env)
         assert isinstance(length, int)
         if not tempfile_limit or length <= tempfile_limit:
             return False
-        fileobj = tempfile.TemporaryFile()
+        fileobj = self.make_tempfile()
         input = self.body_file
         while length:
             data = input.read(min(length, 65536))
         self.environ['wsgi.input'] = fileobj
         return True
+    def make_tempfile(self):
+        """
+            Create a tempfile to store big request body
+        """
+        return tempfile.TemporaryFile()
     def remove_conditional_headers(self, remove_encoding=True, remove_range=True,
                                         remove_match=True, remove_modified=True):