  
  
  # TODO: Replace this with new Serializer code based on Forms API.
  
  #class Resource(object):
  #    def __init__(self, view):
  #        self.view = view
  #    
  #    def object_to_data(self, obj):
  #        pass
  #    
  #    def data_to_object(self, data, files):
  #        pass
  #
  #class FormResource(object):
  #    pass
  #
  #class ModelResource(object):
  #    pass
  
  
  class Resource(object):
      """
      A Resource determines how a python object maps to some serializable data.
 
</s> remove class Resource(object):
 </s> add class Resource(BaseResource): </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     @classmethod
    def object_to_serializable(self, data):
        """A (horrible) munging of Piston's pre-serialization.  Returns a dict"""
 </s> add     # TODO: Replace this with new Serializer code based on Forms API.
    def object_to_data(self, obj):
        """
        A (horrible) munging of Piston's pre-serialization.  Returns a dict.
        """ </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 
  
  
  # TODO: Replace this with new Serializer code based on Forms API.
  















  
  
  class Resource(object):
      """
      A Resource determines how a python object maps to some serializable data.
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 refactoring resource specfic stuff into ResourceMixin - validators now defunct 
djangorestframework/resource.py