Override to not serialize doc responses.
551759
def _serialize_object(self, response_data, request):
        
        if self._is_doc_request(request):
            return response_data
        else:
            return super(DocumentedResource, self)._serialize_object(
                response_data, request)
1216755
def render_serialization(self, context, result):
		""""""
		
		resp = context.response
		serial = context.serialize
		match = context.request.accept.best_match(serial.types, default_match=self.default)
		result = serial[match](result)
		
		if isinstance(result, str):
			result = result.decode('utf-8')
		
		resp.charset = 'utf-8'
		resp.content_type = match
		resp.text = result
		
		return True
495886
def dump_request_and_response(self, response):
        
        if response.reason is None:
            response.reason = "<unknown>"
        return d1_client.util.normalize_request_response_dump(
            requests_toolbelt.utils.dump.dump_response(response)
        )
1259348
def _ensure_html_header(response):
    # type: (Response) -> None
    
    content_type = response.headers.get("Content-Type", "")
    if not content_type.lower().startswith("text/html"):
        raise _NotHTML(content_type, response.request.method)
1315614
@SuppressWarnings("unchecked")
    protected Map<String, byte[]> documentToBytesMap(Map<String, Object> doc) {
        if (doc == null || doc.size() == 0) {
            return Collections.EMPTY_MAP;
        }
        Map<String, byte[]> data = new HashMap<>();
        doc.forEach((k, v) -> {
            byte[] value = SerializationUtils.toByteArrayFst(v);
            if (value != null) {
                data.put(k, value);
            }
        });
        return data;
    }
383755
def serialize(self):
        """"""
        # Serialize fields to a dict
        elements = []
        for element in self.elements:
            elements.append(element.serialize())
        data = {'type': 'document', 'elements': elements}
        return data
732756
def raw(request):
    """"""
    foos = foobar_models.Foo.objects.all()
    return HttpResponse(tree.xml(foos), mimetype='text/xml')
585440
def format_endpoint_returns_doc(endpoint):
    """"""
    description = clean_description(py_doc_trim(endpoint._returns._description))
    return {
        'description': description,
        'resource_name': endpoint._returns._value_type,
        'resource_type': endpoint._returns.__class__.__name__
    }
1058466
def prettyfy(response, format='json'):
    
    if format == 'json':
        return pretty_json(response.content)
    else:
        return pretty_xml(response.content)
1276570
def send_response_only(self, code, message=None):
        """"""
        if message is None:
            if code in self.responses:
                message = self.responses[code][0]
            else:
                message = ''
        if self.request_version != 'HTTP/0.9':
            if not hasattr(self, '_headers_buffer'):
                self._headers_buffer = []
            self._headers_buffer.append(("%s %d %s\r\n" %
                    (self.protocol_version, code, message)).encode(
                        'latin-1', 'strict'))
1357002
def unread(self, include_deleted=False):
        """"""
        if is_soft_delete() and not include_deleted:
            return self.filter(unread=True, deleted=False)

        # When SOFT_DELETE=False, developers are supposed NOT to touch 'deleted' field.
        # In this case, to improve query performance, don't filter by 'deleted' field
        return self.filter(unread=True)
218652
def clean_server_response(self, resp_dict):
        

        # change all the keys from unicode to string
        d = {}
        for key, value in resp_dict.items():
            d[str(key)] = value
        resp_dict = d
        for key, value in resp_dict.items():
            if type(value) is str or isinstance(value, six.string_types):
                if re.match('-', value):
                    try:
                        if float(value) or int(value):
                            dataType = True
                    except ValueError:
                        resp_dict[key] = None
                elif re.search(r'^[0-9,.]+$', value):
                    # replace , to '', and type cast to int
                    resp_dict[key] = float(re.sub(',', '', value))
                else:
                    resp_dict[key] = str(value)
        return resp_dict
124867
protected Document responseToDoc(String response){
        Document doc = null;
        try {
            DocumentBuilderFactory factory = new DocumentBuilderFactoryImpl();
            DocumentBuilderFactory.newInstance();
            DocumentBuilder builder =  factory.newDocumentBuilder();
            ByteArrayInputStream input =  new ByteArrayInputStream(response.getBytes("UTF-8"));
            doc = builder.parse(input);
        } catch (ParserConfigurationException e) {
            LOG.error("ParserConfigurationException", e);
        } catch (UnsupportedEncodingException e) {
            LOG.error("UnsupportedEncodingException", e);
        } catch (IOException e) {
            LOG.error("IOException", e);
        } catch (SAXException e) {
            LOG.error("SAXException", e);
        }

        return doc;
    }
643451
def _validate_output_data(
        self, original_res, serialized_res, formatted_res, request):
        
        if self._is_doc_request(request):
            return
        else:
            return super(DocumentedResource, self)._validate_output_data(
                original_res, serialized_res, formatted_res, request)
1211399
private void serializeEntityDocument(EntityDocument entityDocument) {
		try {
			if (this.entityDocumentCount > 0) {
				this.outputStream.write(JSON_SEP);
			}
			mapper.writeValue(this.outputStream, entityDocument);
		} catch (IOException e) {
			reportException(e);
		}
		this.entityDocumentCount++;
	}
864174
def process_document(self, doc, std):
        """"""
        if doc.url not in self.blacklist:
            print("Indexing '%s' %s..." % (doc.url, std))
            name = self.extract_name(doc.text)
            self.results.add((name, doc.url, std))
        else:
            print("Skipping blacklisted page '%s' ..." % doc.url)
            return None
1371797
function serializeDoctype (node) {
  var r = '<!DOCTYPE ' + node.name;

  if (node.publicId) {
    r += ' PUBLIC "' + node.publicId + '"';
  }

  if (!node.publicId && node.systemId) {
    r += ' SYSTEM';
  }

  if (node.systemId) {
    r += ' "' + node.systemId + '"';
  }

  r += '>';
  return r;
}