Reads the request body and tries to parse it as a web form.

        Parsing is done using the stdlib's `cgi.FieldStorage` class
        which supports multipart forms (file uploads).
        Returns a `QueryDict` object holding the form fields. Uploaded files
        are represented as form fields with a 'filename' attribute.

def form(self):
        """Reads the request body and tries to parse it as a web form.

        Parsing is done using the stdlib's `cgi.FieldStorage` class
        which supports multipart forms (file uploads).
        Returns a `QueryDict` object holding the form fields. Uploaded files
        are represented as form fields with a 'filename' attribute.
        """
        if self._form is None:
            # Make sure FieldStorage always parses the form content,
            # and never the query string.
            environ = self.environ.copy()
            environ['QUERY_STRING'] = ''
            environ['REQUEST_METHOD'] = 'POST'
            fs = cgi.FieldStorage(
                fp=self.input,
                environ=environ,
                keep_blank_values=True)
            # File upload field handling copied from WebOb
            fields = []
            for f in fs.list or []:
                if f.filename:
                    f.filename = f.filename.decode('utf-8')
                    fields.append((f.name.decode('utf-8'), f))
                else:
                    fields.append(
                        (f.name.decode('utf-8'), f.value.decode('utf-8'))
                    )
            self._form = QueryDict(fields)
        return self._form