'Read data from request body'

def read_body(self):

    self.files = Storage()
    content_type = self.env.get('content_type')
    source = []
    if (content_type and content_type.startswith('multipart/')):
        import cgi
        ext = ('.%s' % self.representation)
        post_vars = self.post_vars
        for v in post_vars:
            p = post_vars[v]
            if (isinstance(p, cgi.FieldStorage) and p.filename):
                self.files[p.filename] = p.file
                if p.filename.endswith(ext):
                    source.append((v, p.file))
            elif v.endswith(ext):
                if isinstance(p, cgi.FieldStorage):
                    source.append((v, p.value))
                elif isinstance(p, basestring):
                    source.append((v, StringIO(p)))
    else:
        s = self.body
        s.seek(0)
        source.append(s)
    return source
