def _clean_input_data(self, data, request):
        """ Clean input data. """

        # sanity check
        if not self._is_data_method(request):
            # this is not PUT or POST -> return
            return data

        # do cleaning
        try:
            if self.representation:
                # representation defined -> perform validation
                self._validate_input_data(data, request)
            if self.factory:
                # factory defined -> create object
                return self._create_object(data, request)
            else:
                # no factory nor representation -> return the same data back
                return data
        except ValidationError, exc:
            return self._input_validation_failed(exc, data, request)
def _clean_input_data ( self , data , request ) : if not self . _is_data_method ( request ) : return data try : if self . representation : self . _validate_input_data ( data , request ) if self . factory : return self . _create_object ( data , request ) else : return data except ValidationError , exc : return self . _input_validation_failed ( exc , data , request )
Clean input data.