swiftly/cli/put.py
def cli_put_container(context, path):
    """
    Performs a PUT on the container.

    See :py:mod:`swiftly.cli.put` for context usage information.

    See :py:class:`CLIPut` for more information.
    """
    path = path.rstrip('/')
    if '/' in path:
        raise ReturnCode('called cli_put_container with object %r' % path)
    body = None
    if context.input_:
        if context.input_ == '-':
            body = context.io_manager.get_stdin()
        else:
            body = open(context.input_, 'rb')
    with context.client_manager.with_client() as client:
        status, reason, headers, contents = client.put_container(
            path, headers=context.headers, query=context.query,
            cdn=context.cdn, body=body)
        if hasattr(contents, 'read'):
            contents.read()
    if status // 100 != 2:
        raise ReturnCode(
            'putting container %r: %s %s' % (path, status, reason))
def cli_put_container(context, path):
    path = path.rstrip('/')
    if '/' in path:
        raise ReturnCode('called cli_put_container with object %r' % path)
    body = None
    if context.input_:
        if context.input_ == '-':
            body = context.io_manager.get_stdin()
        else:
            body = open(context.input_, 'rb')
    with context.client_manager.with_client() as client:
        status, reason, headers, contents = client.put_container(
            path, headers=context.headers, query=context.query,
            cdn=context.cdn, body=body)
        if hasattr(contents, 'read'):
            contents.read()
    if status // 100 != 2:
        raise ReturnCode(
            'putting container %r: %s %s' % (path, status, reason))
def cli_put_container ( context , path ) : path = path . rstrip ( '/' ) if '/' in path : raise ReturnCode ( 'called cli_put_container with object %r' % path ) body = None if context . input_ : if context . input_ == '-' : body = context . io_manager . get_stdin ( ) else : body = open ( context . input_ , 'rb' ) with context . client_manager . with_client ( ) as client : status , reason , headers , contents = client . put_container ( path , headers = context . headers , query = context . query , cdn = context . cdn , body = body ) if hasattr ( contents , 'read' ) : contents . read ( ) if status // 100 != 2 : raise ReturnCode ( 'putting container %r: %s %s' % ( path , status , reason ) )
Performs a PUT on the container.

    See :py:mod:`swiftly.cli.put` for context usage information.

    See :py:class:`CLIPut` for more information.
Performs a PUT on the container .