'Copy wsgi.input to tempfile if necessary. Returns True if it did.'

def _copy_body_tempfile(self):

    tempfile_limit = self.request_body_tempfile_limit
    todo = self.content_length
    assert isinstance(todo, integer_types), todo
    if ((not tempfile_limit) or (todo <= tempfile_limit)):
        return False
    fileobj = self.make_tempfile()
    input = self.body_file
    while (todo > 0):
        data = input.read(min(todo, 65536))
        if (not data):
            raise DisconnectionError(('Client    disconnected    (%s    more    bytes    were    expected)' % todo))
        fileobj.write(data)
        todo -= len(data)
    fileobj.seek(0)
    self.body_file_raw = fileobj
    self.is_body_seekable = True
    return True
