          """Ensure that MultiPartParser can parse multipart/form-data that contains a mix of several files and parameters."""
          post_req = RequestFactory().post('/', self.body, content_type=self.content_type)
          view = BaseView()
          view.request = post_req
          parsed = MultiPartParser(view).parse(StringIO(self.body))
          self.assertEqual(parsed['key1'], 'val1')
          self.assertEqual(parsed.FILES['file1'].read(), 'blablabla')
  
 
</s> remove     def _get_raw_content(self):
        """
        Returns the parsed content of the request
        """
        if not hasattr(self, '_raw_content'):
            self._raw_content = self.parse(self.stream, self.content_type)
        return self._raw_content
 </s> add     def _load_data_and_files(self):
        (self._data, self._files) = self._parse(self.stream, self.content_type) </s> remove         form_data = {view.CONTENT_PARAM: content,
                     view.CONTENTTYPE_PARAM: content_type}
 </s> add         form_data = {view._CONTENT_PARAM: content,
                     view._CONTENTTYPE_PARAM: content_type} </s> remove # TODO: Replace this with new Serializer code based on Forms API.
 </s> add def _form_to_data(form):
    """
    Returns a dict containing the data in a form instance.
    
    This code is pretty much a clone of the ``Form.as_p()`` ``Form.as_ul``
    and ``Form.as_table()`` methods, except that it returns data suitable
    for arbitrary serialization, rather than rendering the result directly
    into html.
    """
    ret = {}
    for name, field in form.fields.items():
        if not form.is_bound:
            data = form.initial.get(name, field.initial)
            if callable(data):
                data = data()
        else:
            if isinstance(field, FileField) and form.data is None:
                data = form.initial.get(name, field.initial)
            else:
                data = field.widget.value_from_datadict(form.data, form.files, name)
        ret[name] = field.prepare_value(data)
    return ret </s> remove     # Optional form for input validation and presentation of HTML formatted responses.
    form = None

 </s> add  </s> remove     # TODO: Acutally this needs to go into Resource
    def validate(self, content):
        """
        Validate, cleanup, and type-ify the request content.
        """
        for validator_cls in self.validators:
            validator = validator_cls(self)
            content = validator.validate(content)
        return content


    # TODO: Acutally this needs to go into Resource
    def get_bound_form(self, content=None):
        """
        Return a bound form instance for the given content,
        if there is an appropriate form validator attached to the view.
        """
        for validator_cls in self.validators:
            if hasattr(validator_cls, 'get_bound_form'):
                validator = validator_cls(self)
                return validator.get_bound_form(content)
        return None


 </s> add 
        (data, files) = MultiPartParser(view).parse(StringIO(self.body))
        self.assertEqual(data['key1'], 'val1')
        self.assertEqual(files['file1'].read(), 'blablabla')
          """Ensure that MultiPartParser can parse multipart/form-data that contains a mix of several files and parameters."""
          post_req = RequestFactory().post('/', self.body, content_type=self.content_type)
          view = BaseView()
          view.request = post_req
        (data, files) = MultiPartParser(view).parse(StringIO(self.body))
        self.assertEqual(data['key1'], 'val1')
        self.assertEqual(files['file1'].read(), 'blablabla')
        (data, files) = MultiPartParser(view).parse(StringIO(self.body))
        self.assertEqual(data['key1'], 'val1')
        self.assertEqual(files['file1'].read(), 'blablabla')
        (data, files) = MultiPartParser(view).parse(StringIO(self.body))
        self.assertEqual(data['key1'], 'val1')
        self.assertEqual(files['file1'].read(), 'blablabla')
  
keep keep keep keep replace replace replace keep
 refactoring resource specfic stuff into ResourceMixin - validators now defunct 
djangorestframework/tests/parsers.py