Mariano Mara avatar Mariano Mara committed 0394201 Merge

Merging latest changes from official repo

Comments (0)

Files changed (4)

 .. 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
+Schetnin.
 
 WebOb is released under an `MIT-style license <license.html>`_.
 
 ``req.POST``:
     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.
 
 ``req.params``:
     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+.
-
-
     keywords='wsgi request web http',
     author='Ian Bicking',
     author_email='ianb@colorstudy.com',
+    maintainer='Sergey Schetinin',
+    maintainer_email='sergey@maluke.com',
     url='http://pythonpaste.org/webob/',
     license='MIT',
     packages=['webob'],

tests/test_request.py

     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():
         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)
         new_req.copy_body()
         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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.