swiftly/cli/put.py
def _get_manifest_body(context, prefix, path2info, put_headers):
    """
    Returns body for manifest file and modifies put_headers.

    path2info is a dict like {"path": (size, etag)}
    """
    if context.static_segments:
        body = json.dumps([
            {'path': '/' + p, 'size_bytes': s, 'etag': e}
            for p, (s, e) in sorted(six.iteritems(path2info))
        ])
        put_headers['content-length'] = str(len(body))
        context.query['multipart-manifest'] = 'put'
    else:
        body = ''
        put_headers['content-length'] = '0'
        put_headers['x-object-manifest'] = prefix

    return body
def _get_manifest_body(context, prefix, path2info, put_headers):
    """
    Returns body for manifest file and modifies put_headers.

    path2info is a dict like {"path": (size, etag)}
    """
    if context.static_segments:
        body = json.dumps([
            {'path': '/' + p, 'size_bytes': s, 'etag': e}
            for p, (s, e) in sorted(six.iteritems(path2info))
        ])
        put_headers['content-length'] = str(len(body))
        context.query['multipart-manifest'] = 'put'
    else:
        body = ''
        put_headers['content-length'] = '0'
        put_headers['x-object-manifest'] = prefix

    return body
Returns body for manifest file and modifies put_headers.

    path2info is a dict like {"path": (size, etag)}