def parse(self, stream): """ Returns a 2-tuple of `(data, files)`. `data` will be an object which is the parsed content of the response. `files` will always be `None`. """ try: return (yaml.safe_load(stream), None) except ValueError, exc: raise ErrorResponse(status.HTTP_400_BAD_REQUEST, {"detail": "YAML parse error - %s" % unicode(exc)})
def parse(self, stream): """ Returns a 2-tuple of `(data, files)`. `data` will be an object which is the parsed content of the response. `files` will always be `None`. """ try: return (yaml.safe_load(stream), None) except ValueError, exc: raise ErrorResponse(status.HTTP_400_BAD_REQUEST, {'detail': 'YAML parse error - %s' % unicode(exc)})
def parse(self, stream): """ Returns a 2-tuple of `(data, files)`. `data` will be an object which is the parsed content of the response. `files` will always be `None`. """ try: return (yaml.safe_load(stream), None) except (ValueError, yaml.parser.ParserError) as exc: content = {'detail': 'YAML parse error - %s' % str(exc)} raise ErrorResponse(status.HTTP_400_BAD_REQUEST, content)