def serve_json(data, profile=None): content_type = 'application/json' if profile is not None: content_type += ';profile="%s"' % (profile,) response.set_content_type(content_type) response.set_data(json.dumps(data)) return response._get_current_object()
def serve_json(data, profile=None): content_type = 'application/json' if profile is not None: content_type += ';profile="%s"' % (profile, ) response.set_content_type(content_type) response.set_data(json.dumps(data)) # HACK: See wrap_with_validation. response.original_data = data # type: ignore[attr-defined] # TODO: Why don't we just return response? We access a private method of LocalProxy here... return response._get_current_object() # type: ignore[attr-defined]
def serve_group(group, serializer): response.set_data(json.dumps(serializer(group))) if response.status_code != 204: response.set_content_type('application/json') response.headers.add('ETag', constructors.etag_of_dict(group).to_header()) return response._get_current_object()
def _serve_host(host): response.set_data(json.dumps(serialize_host(host))) response.set_content_type('application/json') response.headers.add('ETag', constructors.etag_of_obj(host).to_header()) return response._get_current_object()
def sucess(status=200): response.status_code = status # TODO: Why don't we just return response? We access a private method of LocalProxy here... return response._get_current_object() # type: ignore[attr-defined]
def sucess(status=200): response.status_code = status return response._get_current_object()