(self, request, container_name, object_name)
Get an object from a container.
Get an object from a container.
Get an object from a container .
def get_object(self, request, container_name, object_name):
        """
        Get an object from a container.
        """
        if container_name in self.containers:
            container = self.containers[container_name]
            if object_name in container.objects:
                obj = container.objects[object_name]

                def set_header_if_not_none(header_key, obj_value):
                    if obj_value is not None:
                        request.responseHeaders.setRawHeaders(
                            header_key, [obj_value.encode("ascii")])

                set_header_if_not_none(
                    b"content-type",
                    obj.content_type if obj.content_type is not None else
                    u"application/octet-stream")
                set_header_if_not_none(b"content-encoding", obj.content_encoding)
                set_header_if_not_none(b"etag", obj.etag)
                set_header_if_not_none(b"x-object-manifest", obj.object_manifest)
                set_header_if_not_none(b"x-object-meta-name", obj.object_meta_name)

                request.setResponseCode(200)
                return container.objects[object_name].data
            else:
                return NoResource("No such object in container")
        else:
            return NoResource("No such container")
def get_object ( self , request , container_name , object_name ) : if container_name in self . containers : container = self . containers [ container_name ] if object_name in container . objects : obj = container . objects [ object_name ] def set_header_if_not_none ( header_key , obj_value ) : if obj_value is not None : request . responseHeaders . setRawHeaders ( header_key , [ obj_value . encode ( "ascii" ) ] ) set_header_if_not_none ( b"content-type" , obj . content_type if obj . content_type is not None else u"application/octet-stream" ) set_header_if_not_none ( b"content-encoding" , obj . content_encoding ) set_header_if_not_none ( b"etag" , obj . etag ) set_header_if_not_none ( b"x-object-manifest" , obj . object_manifest ) set_header_if_not_none ( b"x-object-meta-name" , obj . object_meta_name ) request . setResponseCode ( 200 ) return container . objects [ object_name ] . data else : return NoResource ( "No such object in container" ) else : return NoResource ( "No such container" )