(project, user, board, clone=False)
return new
Paste items into project from clipboard.
Paste items into project from clipboard.
Paste items into project from clipboard .
def paste(project, user, board, clone=False):
    """
    Paste items into project from clipboard.
    """

    obj_map = {COPIED_RESULTS: Job, COPIED_DATA: Data, COPIED_RECIPES: Analysis}
    key, vals = board

    def copier(instance):
        if key == COPIED_RECIPES:
            # Paste objects in clipboard as recipes
            return recipe_paste(user=user, project=project, clone=clone, instance=instance)
        else:
            # Paste objects in clipboard as data
            return data_paste(user=user, project=project, instance=instance)

    # Special case to paste files.
    if key == COPIED_FILES:
        # Add each path in clipboard as a data object.
        new = [data_paste(project=project, user=user, path=p) for p in vals]
        return new

    # Map the objects in the clipboard to a database class.
    klass = obj_map.get(key)
    if not klass:
        return []

    # Select existing object by uid.
    objs = [klass.objects.filter(uid=uid).first() for uid in vals]
    objs = filter(None, objs)

    # Apply copier to each object.
    new = list(map(copier, objs))

    return new
def paste ( project , user , board , clone = False ) : obj_map = { COPIED_RESULTS : Job , COPIED_DATA : Data , COPIED_RECIPES : Analysis } key , vals = board def copier ( instance ) : if key == COPIED_RECIPES : # Paste objects in clipboard as recipes return recipe_paste ( user = user , project = project , clone = clone , instance = instance ) else : # Paste objects in clipboard as data return data_paste ( user = user , project = project , instance = instance ) # Special case to paste files. if key == COPIED_FILES : # Add each path in clipboard as a data object. new = [ data_paste ( project = project , user = user , path = p ) for p in vals ] return new # Map the objects in the clipboard to a database class. klass = obj_map . get ( key ) if not klass : return [ ] # Select existing object by uid. objs = [ klass . objects . filter ( uid = uid ) . first ( ) for uid in vals ] objs = filter ( None , objs ) # Apply copier to each object. new = list ( map ( copier , objs ) ) return new