Ejemplo n.º 1
0
def format_msg_create(directory):
    """returns a message explaining wha directories
    are about to be created and asks user if they want to proceed
    """
    if os.path.exists(directory):
        raise Exception('directory %s aready exists' % directory)
    else:
        prefix, tail = path_utils.split_at_break_point(directory)
        data = {
                'existing_prefix': prefix,
                'non_existing_tail': tail,
            }
        return CONFIRM_DIR_CREATION % data
Ejemplo n.º 2
0
def format_msg_create(directory):
    """returns a message explaining wha directories
    are about to be created and asks user if they want to proceed
    """
    if os.path.exists(directory):
        raise Exception('directory %s aready exists' % directory)
    else:
        prefix, tail = path_utils.split_at_break_point(directory)
        data = {
            'existing_prefix': prefix,
            'non_existing_tail': tail,
        }
        return CONFIRM_DIR_CREATION % data
Ejemplo n.º 3
0
def format_msg_dir_not_writable(directory):
    """returns a meaningful message explaining why directory
    is not writable by the user
    """
    if os.path.exists(directory):
        if path_utils.directory_is_writable(directory):
            return ''
        return DIR_IS_NOT_WRITABLE % {'dir': directory}

    prefix, tail = path_utils.split_at_break_point(directory)
    data = {
        'existing_prefix': prefix,
        'non_existing_tail': tail,
        'target_dir': directory
    }
    return PARENT_DIR_IS_NOT_WRITABLE % data
Ejemplo n.º 4
0
def format_msg_dir_not_writable(directory):
    """returns a meaningful message explaining why directory 
    is not writable by the user
    """
    if os.path.exists(directory):
        if path_utils.directory_is_writable(directory):
            return ''
        else:
            return DIR_IS_NOT_WRITABLE % {'dir': directory}
    else:
        prefix, tail = path_utils.split_at_break_point(directory)
        data = {
                'existing_prefix': prefix,
                'non_existing_tail': tail,
                'target_dir': directory
            }
        return PARENT_DIR_IS_NOT_WRITABLE % data