Example #1
0
def get_by_id(caller_id, farm_id):
    """
    Returns requested Farm.

    @cmview_user
    @param_post{farm_id,int} id of the requested Farm

    @response{dict} Farm.dict property of the requested Farm
    """
    return Farm.get(caller_id, farm_id).dict
Example #2
0
def get_by_id(caller_id, farm_id):
    """
    Returns requested Farm.

    @cmview_user
    @param_post{farm_id,int} id of the requested Farm

    @response{dict} Farm.dict property of the requested Farm
    """
    return Farm.get(caller_id, farm_id).dict
Example #3
0
def get_by_id(caller_id, farm_id):
    """
    Returns requested Farm.

    @decoratedby{src.cm.utils.decorators.user_log}
    @parameter{farm_id,int} id of the requested Farm

    @response{dict} requested Farm's data
    \n fields @asreturned{src.cm.database.entities.farm.Farm.get()}
    """
    return Farm.get(caller_id, farm_id).dict
Example #4
0
def destroy(caller_id, farm_id):
    """
    Destroys caller's farms with ids listed in data.

    @decoratedby{src.cm.utils.decorators.user_log}
    @parameter{data,list} list of destroyed farm's \c id's

    @response @asreturned{src.cm.manager.farm.utils.destroy()}
    """

    return Farm.destroy([Farm.get(caller_id, farm_id)])
Example #5
0
def destroy(caller_id, farm_id):
    """
    Destroys specified caller's farm.

    @cmview_user
    @param_post{farm_id,int} destroyed farm's id

    @response @asreturned{src.cm.manager.farm.utils.destroy()}
    """

    return Farm.destroy([Farm.get(caller_id, farm_id)])
Example #6
0
def destroy(caller_id, farm_id):
    """
    Destroys specified caller's farm.

    @cmview_user
    @param_post{farm_id,int} destroyed farm's id

    @response @asreturned{src.cm.manager.farm.utils.destroy()}
    """

    return Farm.destroy([Farm.get(caller_id, farm_id)])
Example #7
0
def save_and_shutdown(caller_id, farm_id, name, description):
    """
    Safely saves and shutdowns Farm's Head.

    @cmview_user
    @param_post{farm_id,int}
    @param_post{name,string}
    @param_post{description,string}

    @response{src.cm.manager.farm.utils.save_and_shutdown()}
    """
    farm = Farm.get(caller_id, farm_id)
    if farm.user.id == caller_id:
        return Farm.save_and_shutdown(farm, name, description)
    else:
        raise CMException("farm_save")
Example #8
0
def save_and_shutdown(caller_id, farm_id, name, description):
    """
    Safely saves and shutdowns Farm's Head.

    @cmview_user
    @param_post{farm_id,int}
    @param_post{name,string}
    @param_post{description,string}

    @response{src.cm.manager.farm.utils.save_and_shutdown()}
    """
    farm = Farm.get(caller_id, farm_id)
    if farm.user.id == caller_id:
        return Farm.save_and_shutdown(farm, name, description)
    else:
        raise CMException("farm_save")
Example #9
0
def save_and_shutdown(caller_id, farm_id, name, description):
    """
    Saves and shutdowns safely farm's Head.
    It saves Head to image described in \c data.
    @decoratedby{src.cm.utils.decorators.user_log}

    @parameter{farm_id,int}
    @parameter{data,dict}
    \n fields @asrequired{src.cm.farm.utils.save_and_shutdown()}

    @response{src.cm.manager.farm.utils.save_and_shutdown()}
    """
    farm = Farm.get(caller_id, farm_id)
    if farm.user.id == caller_id:
        return Farm.save_and_shutdown(farm, name, description)
    else:
        raise CMException("farm_save")